aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/acpi/acoutput.h2
-rw-r--r--include/acpi/platform/aclinux.h6
-rw-r--r--include/asm-arm/plat-s3c/iic.h33
-rw-r--r--include/asm-arm/plat-s3c/nand.h50
-rw-r--r--include/asm-arm/plat-s3c/regs-ac97.h67
-rw-r--r--include/asm-arm/plat-s3c/regs-iic.h56
-rw-r--r--include/asm-arm/plat-s3c/regs-nand.h123
-rw-r--r--include/asm-arm/plat-s3c/regs-rtc.h61
-rw-r--r--include/asm-arm/plat-s3c/regs-watchdog.h41
-rw-r--r--include/asm-arm/plat-s3c24xx/mci.h15
-rw-r--r--include/asm-arm/plat-s3c24xx/regs-spi.h82
-rw-r--r--include/asm-arm/plat-s3c24xx/regs-udc.h153
-rw-r--r--include/asm-arm/plat-s3c24xx/udc.h36
-rw-r--r--include/asm-generic/bug.h15
-rw-r--r--include/asm-generic/memory_model.h2
-rw-r--r--include/asm-generic/pgtable.h50
-rw-r--r--include/asm-generic/vmlinux.lds.h10
-rw-r--r--include/asm-m68k/bitops.h5
-rw-r--r--include/asm-m68k/byteorder.h16
-rw-r--r--include/asm-m68k/machw.h22
-rw-r--r--include/crypto/aes.h8
-rw-r--r--include/crypto/algapi.h16
-rw-r--r--include/crypto/hash.h125
-rw-r--r--include/crypto/internal/hash.h16
-rw-r--r--include/drm/Kbuild2
-rw-r--r--include/drm/drm.h24
-rw-r--r--include/drm/drmP.h108
-rw-r--r--include/drm/drm_crtc.h733
-rw-r--r--include/drm/drm_crtc_helper.h124
-rw-r--r--include/drm/drm_edid.h202
-rw-r--r--include/drm/drm_mode.h271
-rw-r--r--include/drm/drm_sarea.h6
-rw-r--r--include/drm/i915_drm.h41
-rw-r--r--include/keys/keyring-type.h31
-rw-r--r--include/linux/aio.h5
-rw-r--r--include/linux/atm.h17
-rw-r--r--include/linux/atmdev.h15
-rw-r--r--include/linux/audit.h26
-rw-r--r--include/linux/binfmts.h16
-rw-r--r--include/linux/bio.h26
-rw-r--r--include/linux/bitmap.h35
-rw-r--r--include/linux/bitops.h13
-rw-r--r--include/linux/blkdev.h52
-rw-r--r--include/linux/bottom_half.h1
-rw-r--r--include/linux/buffer_head.h1
-rw-r--r--include/linux/capability.h25
-rw-r--r--include/linux/cgroup_subsys.h6
-rw-r--r--include/linux/console.h4
-rw-r--r--include/linux/cpumask.h221
-rw-r--r--include/linux/crc32c.h6
-rw-r--r--include/linux/cred.h342
-rw-r--r--include/linux/crypto.h10
-rw-r--r--include/linux/dcbnl.h340
-rw-r--r--include/linux/dccp.h42
-rw-r--r--include/linux/dmi.h5
-rw-r--r--include/linux/elevator.h8
-rw-r--r--include/linux/etherdevice.h46
-rw-r--r--include/linux/ethtool.h2
-rw-r--r--include/linux/fault-inject.h9
-rw-r--r--include/linux/fb.h2
-rw-r--r--include/linux/fddidevice.h1
-rw-r--r--include/linux/filter.h3
-rw-r--r--include/linux/fs.h18
-rw-r--r--include/linux/fsl_devices.h18
-rw-r--r--include/linux/ftrace.h21
-rw-r--r--include/linux/futex.h3
-rw-r--r--include/linux/genhd.h1
-rw-r--r--include/linux/hardirq.h13
-rw-r--r--include/linux/hdlc.h4
-rw-r--r--include/linux/hippidevice.h4
-rw-r--r--include/linux/hrtimer.h34
-rw-r--r--include/linux/ide.h37
-rw-r--r--include/linux/ieee80211.h212
-rw-r--r--include/linux/if.h1
-rw-r--r--include/linux/if_arp.h3
-rw-r--r--include/linux/in.h4
-rw-r--r--include/linux/init_task.h14
-rw-r--r--include/linux/input.h2
-rw-r--r--include/linux/interrupt.h5
-rw-r--r--include/linux/ipv6.h1
-rw-r--r--include/linux/irq.h7
-rw-r--r--include/linux/jiffies.h10
-rw-r--r--include/linux/kernel.h12
-rw-r--r--include/linux/key-ui.h66
-rw-r--r--include/linux/key.h32
-rw-r--r--include/linux/keyctl.h4
-rw-r--r--include/linux/lguest_launcher.h6
-rw-r--r--include/linux/libata.h71
-rw-r--r--include/linux/linkage.h8
-rw-r--r--include/linux/list_nulls.h94
-rw-r--r--include/linux/lockd/bind.h1
-rw-r--r--include/linux/lockd/lockd.h4
-rw-r--r--include/linux/lockdep.h14
-rw-r--r--include/linux/mdio-gpio.h25
-rw-r--r--include/linux/mfd/wm8350/audio.h38
-rw-r--r--include/linux/mii.h33
-rw-r--r--include/linux/mlx4/device.h4
-rw-r--r--include/linux/mm.h21
-rw-r--r--include/linux/mm_types.h5
-rw-r--r--include/linux/mroute6.h26
-rw-r--r--include/linux/netdevice.h400
-rw-r--r--include/linux/netfilter/nfnetlink_conntrack.h1
-rw-r--r--include/linux/netfilter_bridge/ebtables.h3
-rw-r--r--include/linux/netfilter_ipv4/ipt_policy.h2
-rw-r--r--include/linux/netfilter_ipv6/ip6t_policy.h2
-rw-r--r--include/linux/netlink.h3
-rw-r--r--include/linux/netpoll.h5
-rw-r--r--include/linux/nfs_fs.h17
-rw-r--r--include/linux/nfs_fs_sb.h6
-rw-r--r--include/linux/nfs_mount.h3
-rw-r--r--include/linux/nfs_xdr.h7
-rw-r--r--include/linux/nfsd/state.h2
-rw-r--r--include/linux/nl80211.h223
-rw-r--r--include/linux/nsproxy.h1
-rw-r--r--include/linux/of.h6
-rw-r--r--include/linux/of_gpio.h44
-rw-r--r--include/linux/of_platform.h3
-rw-r--r--include/linux/oprofile.h3
-rw-r--r--include/linux/pci.h6
-rw-r--r--include/linux/pci_ids.h5
-rw-r--r--include/linux/phy.h2
-rw-r--r--include/linux/pkt_cls.h14
-rw-r--r--include/linux/pkt_sched.h16
-rw-r--r--include/linux/posix-timers.h6
-rw-r--r--include/linux/ptrace.h22
-rw-r--r--include/linux/rcuclassic.h4
-rw-r--r--include/linux/rculist_nulls.h110
-rw-r--r--include/linux/rcupdate.h10
-rw-r--r--include/linux/rcutree.h329
-rw-r--r--include/linux/rfkill.h8
-rw-r--r--include/linux/ring_buffer.h2
-rw-r--r--include/linux/rio_drv.h4
-rw-r--r--include/linux/rtnetlink.h5
-rw-r--r--include/linux/sched.h69
-rw-r--r--include/linux/securebits.h2
-rw-r--r--include/linux/security.h344
-rw-r--r--include/linux/seq_file.h7
-rw-r--r--include/linux/serial_core.h2
-rw-r--r--include/linux/skbuff.h54
-rw-r--r--include/linux/slab.h10
-rw-r--r--include/linux/smp.h18
-rw-r--r--include/linux/smsc911x.h47
-rw-r--r--include/linux/snmp.h3
-rw-r--r--include/linux/stop_machine.h6
-rw-r--r--include/linux/sunrpc/clnt.h2
-rw-r--r--include/linux/sunrpc/rpc_pipe_fs.h1
-rw-r--r--include/linux/sunrpc/svc_xprt.h8
-rw-r--r--include/linux/sunrpc/svcauth_gss.h1
-rw-r--r--include/linux/sunrpc/xdr.h15
-rw-r--r--include/linux/sunrpc/xprt.h3
-rw-r--r--include/linux/swiotlb.h22
-rw-r--r--include/linux/threads.h16
-rw-r--r--include/linux/tick.h4
-rw-r--r--include/linux/timex.h73
-rw-r--r--include/linux/tty.h4
-rw-r--r--include/linux/types.h11
-rw-r--r--include/linux/user_namespace.h13
-rw-r--r--include/linux/videodev2.h14
-rw-r--r--include/linux/virtio_balloon.h3
-rw-r--r--include/linux/virtio_console.h11
-rw-r--r--include/linux/virtio_net.h9
-rw-r--r--include/linux/virtio_pci.h8
-rw-r--r--include/linux/virtio_ring.h13
-rw-r--r--include/linux/xfrm.h14
-rw-r--r--include/media/i2c-addr.h2
-rw-r--r--include/media/ir-common.h2
-rw-r--r--include/media/ov772x.h21
-rw-r--r--include/media/saa7146_vv.h3
-rw-r--r--include/media/soc_camera.h111
-rw-r--r--include/media/tvp514x.h118
-rw-r--r--include/media/tw9910.h39
-rw-r--r--include/media/v4l2-chip-ident.h10
-rw-r--r--include/media/v4l2-common.h41
-rw-r--r--include/media/v4l2-dev.h51
-rw-r--r--include/media/v4l2-device.h109
-rw-r--r--include/media/v4l2-int-device.h6
-rw-r--r--include/media/v4l2-ioctl.h14
-rw-r--r--include/media/v4l2-subdev.h189
-rw-r--r--include/net/bluetooth/bluetooth.h4
-rw-r--r--include/net/bluetooth/hci.h2
-rw-r--r--include/net/cfg80211.h142
-rw-r--r--include/net/checksum.h2
-rw-r--r--include/net/dcbnl.h53
-rw-r--r--include/net/dn.h8
-rw-r--r--include/net/dn_fib.h6
-rw-r--r--include/net/dst.h39
-rw-r--r--include/net/flow.h9
-rw-r--r--include/net/gen_stats.h3
-rw-r--r--include/net/ieee80211.h148
-rw-r--r--include/net/ieee80211_radiotap.h15
-rw-r--r--include/net/inet_hashtables.h85
-rw-r--r--include/net/inet_timewait_sock.h10
-rw-r--r--include/net/ip.h3
-rw-r--r--include/net/ip_vs.h17
-rw-r--r--include/net/irda/irda_device.h4
-rw-r--r--include/net/iucv/iucv.h45
-rw-r--r--include/net/lib80211.h (renamed from include/net/ieee80211_crypt.h)75
-rw-r--r--include/net/mac80211.h446
-rw-r--r--include/net/ndisc.h14
-rw-r--r--include/net/neighbour.h15
-rw-r--r--include/net/net_namespace.h22
-rw-r--r--include/net/netfilter/nf_conntrack.h5
-rw-r--r--include/net/netfilter/nf_conntrack_ecache.h57
-rw-r--r--include/net/netfilter/nf_conntrack_expect.h2
-rw-r--r--include/net/netfilter/nf_conntrack_helper.h5
-rw-r--r--include/net/netfilter/nf_conntrack_l4proto.h2
-rw-r--r--include/net/netfilter/nf_conntrack_tuple.h12
-rw-r--r--include/net/netfilter/nfnetlink_log.h14
-rw-r--r--include/net/netlink.h24
-rw-r--r--include/net/netns/ipv4.h2
-rw-r--r--include/net/netns/ipv6.h12
-rw-r--r--include/net/netns/mib.h3
-rw-r--r--include/net/netns/x_tables.h5
-rw-r--r--include/net/netns/xfrm.h56
-rw-r--r--include/net/phonet/pep.h2
-rw-r--r--include/net/phonet/phonet.h2
-rw-r--r--include/net/phonet/pn_dev.h2
-rw-r--r--include/net/pkt_cls.h2
-rw-r--r--include/net/protocol.h3
-rw-r--r--include/net/sch_generic.h38
-rw-r--r--include/net/scm.h4
-rw-r--r--include/net/sctp/sctp.h9
-rw-r--r--include/net/sctp/user.h2
-rw-r--r--include/net/sock.h86
-rw-r--r--include/net/syncppp.h102
-rw-r--r--include/net/tcp.h20
-rw-r--r--include/net/udp.h25
-rw-r--r--include/net/udplite.h2
-rw-r--r--include/net/wireless.h90
-rw-r--r--include/net/xfrm.h110
-rw-r--r--include/scsi/fc/fc_els.h816
-rw-r--r--include/scsi/fc/fc_encaps.h138
-rw-r--r--include/scsi/fc/fc_fc2.h124
-rw-r--r--include/scsi/fc/fc_fcoe.h114
-rw-r--r--include/scsi/fc/fc_fcp.h199
-rw-r--r--include/scsi/fc/fc_fs.h340
-rw-r--r--include/scsi/fc/fc_gs.h93
-rw-r--r--include/scsi/fc/fc_ns.h159
-rw-r--r--include/scsi/fc_encode.h309
-rw-r--r--include/scsi/fc_frame.h242
-rw-r--r--include/scsi/fc_transport_fcoe.h54
-rw-r--r--include/scsi/iscsi_if.h7
-rw-r--r--include/scsi/libfc.h938
-rw-r--r--include/scsi/libfcoe.h176
-rw-r--r--include/scsi/libiscsi.h39
-rw-r--r--include/scsi/libiscsi_tcp.h132
-rw-r--r--include/scsi/scsi_device.h7
-rw-r--r--include/scsi/scsi_transport_iscsi.h12
-rw-r--r--include/sound/ac97_codec.h2
-rw-r--r--include/sound/asound.h1
-rw-r--r--include/sound/core.h28
-rw-r--r--include/sound/info.h106
-rw-r--r--include/sound/jack.h2
-rw-r--r--include/sound/l3.h18
-rw-r--r--include/sound/s3c24xx_uda134x.h14
-rw-r--r--include/sound/soc-dai.h231
-rw-r--r--include/sound/soc-dapm.h2
-rw-r--r--include/sound/soc.h206
-rw-r--r--include/sound/uda134x.h26
-rw-r--r--include/sound/version.h2
-rw-r--r--include/trace/sched.h12
-rw-r--r--include/video/sh_mobile_lcdc.h1
-rw-r--r--include/xen/interface/event_channel.h2
263 files changed, 11044 insertions, 2877 deletions
diff --git a/include/acpi/acoutput.h b/include/acpi/acoutput.h
index 09d33c7740f..db8852d8bcf 100644
--- a/include/acpi/acoutput.h
+++ b/include/acpi/acoutput.h
@@ -172,7 +172,7 @@
172 172
173/* Defaults for debug_level, debug and normal */ 173/* Defaults for debug_level, debug and normal */
174 174
175#define ACPI_DEBUG_DEFAULT (ACPI_LV_INIT | ACPI_LV_DEBUG_OBJECT) 175#define ACPI_DEBUG_DEFAULT (ACPI_LV_INFO)
176#define ACPI_NORMAL_DEFAULT (ACPI_LV_INIT | ACPI_LV_DEBUG_OBJECT) 176#define ACPI_NORMAL_DEFAULT (ACPI_LV_INIT | ACPI_LV_DEBUG_OBJECT)
177#define ACPI_DEBUG_ALL (ACPI_LV_AML_DISASSEMBLE | ACPI_LV_ALL_EXCEPTIONS | ACPI_LV_ALL) 177#define ACPI_DEBUG_ALL (ACPI_LV_AML_DISASSEMBLE | ACPI_LV_ALL_EXCEPTIONS | ACPI_LV_ALL)
178 178
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 029c8c06c15..0515e754449 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -141,6 +141,10 @@ static inline void *acpi_os_acquire_object(acpi_cache_t * cache)
141/* 141/*
142 * We need to show where it is safe to preempt execution of ACPICA 142 * We need to show where it is safe to preempt execution of ACPICA
143 */ 143 */
144#define ACPI_PREEMPTION_POINT() cond_resched() 144#define ACPI_PREEMPTION_POINT() \
145 do { \
146 if (!irqs_disabled()) \
147 cond_resched(); \
148 } while (0)
145 149
146#endif /* __ACLINUX_H__ */ 150#endif /* __ACLINUX_H__ */
diff --git a/include/asm-arm/plat-s3c/iic.h b/include/asm-arm/plat-s3c/iic.h
deleted file mode 100644
index 5106acaa1d0..00000000000
--- a/include/asm-arm/plat-s3c/iic.h
+++ /dev/null
@@ -1,33 +0,0 @@
1/* arch/arm/mach-s3c2410/include/mach/iic.h
2 *
3 * Copyright (c) 2004 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * S3C2410 - I2C Controller platfrom_device info
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __ASM_ARCH_IIC_H
14#define __ASM_ARCH_IIC_H __FILE__
15
16#define S3C_IICFLG_FILTER (1<<0) /* enable s3c2440 filter */
17
18/* Notes:
19 * 1) All frequencies are expressed in Hz
20 * 2) A value of zero is `do not care`
21*/
22
23struct s3c2410_platform_i2c {
24 int bus_num; /* bus number to use */
25 unsigned int flags;
26 unsigned int slave_addr; /* slave address for controller */
27 unsigned long bus_freq; /* standard bus frequency */
28 unsigned long max_freq; /* max frequency for the bus */
29 unsigned long min_freq; /* min frequency for the bus */
30 unsigned int sda_delay; /* pclks (s3c2440 only) */
31};
32
33#endif /* __ASM_ARCH_IIC_H */
diff --git a/include/asm-arm/plat-s3c/nand.h b/include/asm-arm/plat-s3c/nand.h
deleted file mode 100644
index f4dcd14af05..00000000000
--- a/include/asm-arm/plat-s3c/nand.h
+++ /dev/null
@@ -1,50 +0,0 @@
1/* arch/arm/mach-s3c2410/include/mach/nand.h
2 *
3 * Copyright (c) 2004 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * S3C2410 - NAND device controller platfrom_device info
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13/* struct s3c2410_nand_set
14 *
15 * define an set of one or more nand chips registered with an unique mtd
16 *
17 * nr_chips = number of chips in this set
18 * nr_partitions = number of partitions pointed to be partitoons (or zero)
19 * name = name of set (optional)
20 * nr_map = map for low-layer logical to physical chip numbers (option)
21 * partitions = mtd partition list
22*/
23
24struct s3c2410_nand_set {
25 unsigned int disable_ecc : 1;
26
27 int nr_chips;
28 int nr_partitions;
29 char *name;
30 int *nr_map;
31 struct mtd_partition *partitions;
32 struct nand_ecclayout *ecc_layout;
33};
34
35struct s3c2410_platform_nand {
36 /* timing information for controller, all times in nanoseconds */
37
38 int tacls; /* time for active CLE/ALE to nWE/nOE */
39 int twrph0; /* active time for nWE/nOE */
40 int twrph1; /* time for release CLE/ALE from nWE/nOE inactive */
41
42 unsigned int ignore_unset_ecc : 1;
43
44 int nr_sets;
45 struct s3c2410_nand_set *sets;
46
47 void (*select_chip)(struct s3c2410_nand_set *,
48 int chip);
49};
50
diff --git a/include/asm-arm/plat-s3c/regs-ac97.h b/include/asm-arm/plat-s3c/regs-ac97.h
deleted file mode 100644
index c3878f7acb8..00000000000
--- a/include/asm-arm/plat-s3c/regs-ac97.h
+++ /dev/null
@@ -1,67 +0,0 @@
1/* arch/arm/mach-s3c2410/include/mach/regs-ac97.h
2 *
3 * Copyright (c) 2006 Simtec Electronics <linux@simtec.co.uk>
4 * http://www.simtec.co.uk/products/SWLINUX/
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 * S3C2440 AC97 Controller
11*/
12
13#ifndef __ASM_ARCH_REGS_AC97_H
14#define __ASM_ARCH_REGS_AC97_H __FILE__
15
16#define S3C_AC97_GLBCTRL (0x00)
17
18#define S3C_AC97_GLBCTRL_CODECREADYIE (1<<22)
19#define S3C_AC97_GLBCTRL_PCMOUTURIE (1<<21)
20#define S3C_AC97_GLBCTRL_PCMINORIE (1<<20)
21#define S3C_AC97_GLBCTRL_MICINORIE (1<<19)
22#define S3C_AC97_GLBCTRL_PCMOUTTIE (1<<18)
23#define S3C_AC97_GLBCTRL_PCMINTIE (1<<17)
24#define S3C_AC97_GLBCTRL_MICINTIE (1<<16)
25#define S3C_AC97_GLBCTRL_PCMOUTTM_OFF (0<<12)
26#define S3C_AC97_GLBCTRL_PCMOUTTM_PIO (1<<12)
27#define S3C_AC97_GLBCTRL_PCMOUTTM_DMA (2<<12)
28#define S3C_AC97_GLBCTRL_PCMOUTTM_MASK (3<<12)
29#define S3C_AC97_GLBCTRL_PCMINTM_OFF (0<<10)
30#define S3C_AC97_GLBCTRL_PCMINTM_PIO (1<<10)
31#define S3C_AC97_GLBCTRL_PCMINTM_DMA (2<<10)
32#define S3C_AC97_GLBCTRL_PCMINTM_MASK (3<<10)
33#define S3C_AC97_GLBCTRL_MICINTM_OFF (0<<8)
34#define S3C_AC97_GLBCTRL_MICINTM_PIO (1<<8)
35#define S3C_AC97_GLBCTRL_MICINTM_DMA (2<<8)
36#define S3C_AC97_GLBCTRL_MICINTM_MASK (3<<8)
37#define S3C_AC97_GLBCTRL_TRANSFERDATAENABLE (1<<3)
38#define S3C_AC97_GLBCTRL_ACLINKON (1<<2)
39#define S3C_AC97_GLBCTRL_WARMRESET (1<<1)
40#define S3C_AC97_GLBCTRL_COLDRESET (1<<0)
41
42#define S3C_AC97_GLBSTAT (0x04)
43
44#define S3C_AC97_GLBSTAT_CODECREADY (1<<22)
45#define S3C_AC97_GLBSTAT_PCMOUTUR (1<<21)
46#define S3C_AC97_GLBSTAT_PCMINORI (1<<20)
47#define S3C_AC97_GLBSTAT_MICINORI (1<<19)
48#define S3C_AC97_GLBSTAT_PCMOUTTI (1<<18)
49#define S3C_AC97_GLBSTAT_PCMINTI (1<<17)
50#define S3C_AC97_GLBSTAT_MICINTI (1<<16)
51#define S3C_AC97_GLBSTAT_MAINSTATE_IDLE (0<<0)
52#define S3C_AC97_GLBSTAT_MAINSTATE_INIT (1<<0)
53#define S3C_AC97_GLBSTAT_MAINSTATE_READY (2<<0)
54#define S3C_AC97_GLBSTAT_MAINSTATE_ACTIVE (3<<0)
55#define S3C_AC97_GLBSTAT_MAINSTATE_LP (4<<0)
56#define S3C_AC97_GLBSTAT_MAINSTATE_WARM (5<<0)
57
58#define S3C_AC97_CODEC_CMD (0x08)
59
60#define S3C_AC97_CODEC_CMD_READ (1<<23)
61
62#define S3C_AC97_STAT (0x0c)
63#define S3C_AC97_PCM_ADDR (0x10)
64#define S3C_AC97_PCM_DATA (0x18)
65#define S3C_AC97_MIC_DATA (0x1C)
66
67#endif /* __ASM_ARCH_REGS_AC97_H */
diff --git a/include/asm-arm/plat-s3c/regs-iic.h b/include/asm-arm/plat-s3c/regs-iic.h
deleted file mode 100644
index 2f7c17de8ac..00000000000
--- a/include/asm-arm/plat-s3c/regs-iic.h
+++ /dev/null
@@ -1,56 +0,0 @@
1/* arch/arm/mach-s3c2410/include/mach/regs-iic.h
2 *
3 * Copyright (c) 2004 Simtec Electronics <linux@simtec.co.uk>
4 * http://www.simtec.co.uk/products/SWLINUX/
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 * S3C2410 I2C Controller
11*/
12
13#ifndef __ASM_ARCH_REGS_IIC_H
14#define __ASM_ARCH_REGS_IIC_H __FILE__
15
16/* see s3c2410x user guide, v1.1, section 9 (p447) for more info */
17
18#define S3C2410_IICREG(x) (x)
19
20#define S3C2410_IICCON S3C2410_IICREG(0x00)
21#define S3C2410_IICSTAT S3C2410_IICREG(0x04)
22#define S3C2410_IICADD S3C2410_IICREG(0x08)
23#define S3C2410_IICDS S3C2410_IICREG(0x0C)
24#define S3C2440_IICLC S3C2410_IICREG(0x10)
25
26#define S3C2410_IICCON_ACKEN (1<<7)
27#define S3C2410_IICCON_TXDIV_16 (0<<6)
28#define S3C2410_IICCON_TXDIV_512 (1<<6)
29#define S3C2410_IICCON_IRQEN (1<<5)
30#define S3C2410_IICCON_IRQPEND (1<<4)
31#define S3C2410_IICCON_SCALE(x) ((x)&15)
32#define S3C2410_IICCON_SCALEMASK (0xf)
33
34#define S3C2410_IICSTAT_MASTER_RX (2<<6)
35#define S3C2410_IICSTAT_MASTER_TX (3<<6)
36#define S3C2410_IICSTAT_SLAVE_RX (0<<6)
37#define S3C2410_IICSTAT_SLAVE_TX (1<<6)
38#define S3C2410_IICSTAT_MODEMASK (3<<6)
39
40#define S3C2410_IICSTAT_START (1<<5)
41#define S3C2410_IICSTAT_BUSBUSY (1<<5)
42#define S3C2410_IICSTAT_TXRXEN (1<<4)
43#define S3C2410_IICSTAT_ARBITR (1<<3)
44#define S3C2410_IICSTAT_ASSLAVE (1<<2)
45#define S3C2410_IICSTAT_ADDR0 (1<<1)
46#define S3C2410_IICSTAT_LASTBIT (1<<0)
47
48#define S3C2410_IICLC_SDA_DELAY0 (0 << 0)
49#define S3C2410_IICLC_SDA_DELAY5 (1 << 0)
50#define S3C2410_IICLC_SDA_DELAY10 (2 << 0)
51#define S3C2410_IICLC_SDA_DELAY15 (3 << 0)
52#define S3C2410_IICLC_SDA_DELAY_MASK (3 << 0)
53
54#define S3C2410_IICLC_FILTER_ON (1<<2)
55
56#endif /* __ASM_ARCH_REGS_IIC_H */
diff --git a/include/asm-arm/plat-s3c/regs-nand.h b/include/asm-arm/plat-s3c/regs-nand.h
deleted file mode 100644
index b2caa4bca27..00000000000
--- a/include/asm-arm/plat-s3c/regs-nand.h
+++ /dev/null
@@ -1,123 +0,0 @@
1/* arch/arm/mach-s3c2410/include/mach/regs-nand.h
2 *
3 * Copyright (c) 2004,2005 Simtec Electronics <linux@simtec.co.uk>
4 * http://www.simtec.co.uk/products/SWLINUX/
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 * S3C2410 NAND register definitions
11*/
12
13#ifndef __ASM_ARM_REGS_NAND
14#define __ASM_ARM_REGS_NAND
15
16
17#define S3C2410_NFREG(x) (x)
18
19#define S3C2410_NFCONF S3C2410_NFREG(0x00)
20#define S3C2410_NFCMD S3C2410_NFREG(0x04)
21#define S3C2410_NFADDR S3C2410_NFREG(0x08)
22#define S3C2410_NFDATA S3C2410_NFREG(0x0C)
23#define S3C2410_NFSTAT S3C2410_NFREG(0x10)
24#define S3C2410_NFECC S3C2410_NFREG(0x14)
25
26#define S3C2440_NFCONT S3C2410_NFREG(0x04)
27#define S3C2440_NFCMD S3C2410_NFREG(0x08)
28#define S3C2440_NFADDR S3C2410_NFREG(0x0C)
29#define S3C2440_NFDATA S3C2410_NFREG(0x10)
30#define S3C2440_NFECCD0 S3C2410_NFREG(0x14)
31#define S3C2440_NFECCD1 S3C2410_NFREG(0x18)
32#define S3C2440_NFECCD S3C2410_NFREG(0x1C)
33#define S3C2440_NFSTAT S3C2410_NFREG(0x20)
34#define S3C2440_NFESTAT0 S3C2410_NFREG(0x24)
35#define S3C2440_NFESTAT1 S3C2410_NFREG(0x28)
36#define S3C2440_NFMECC0 S3C2410_NFREG(0x2C)
37#define S3C2440_NFMECC1 S3C2410_NFREG(0x30)
38#define S3C2440_NFSECC S3C2410_NFREG(0x34)
39#define S3C2440_NFSBLK S3C2410_NFREG(0x38)
40#define S3C2440_NFEBLK S3C2410_NFREG(0x3C)
41
42#define S3C2412_NFSBLK S3C2410_NFREG(0x20)
43#define S3C2412_NFEBLK S3C2410_NFREG(0x24)
44#define S3C2412_NFSTAT S3C2410_NFREG(0x28)
45#define S3C2412_NFMECC_ERR0 S3C2410_NFREG(0x2C)
46#define S3C2412_NFMECC_ERR1 S3C2410_NFREG(0x30)
47#define S3C2412_NFMECC0 S3C2410_NFREG(0x34)
48#define S3C2412_NFMECC1 S3C2410_NFREG(0x38)
49#define S3C2412_NFSECC S3C2410_NFREG(0x3C)
50
51#define S3C2410_NFCONF_EN (1<<15)
52#define S3C2410_NFCONF_512BYTE (1<<14)
53#define S3C2410_NFCONF_4STEP (1<<13)
54#define S3C2410_NFCONF_INITECC (1<<12)
55#define S3C2410_NFCONF_nFCE (1<<11)
56#define S3C2410_NFCONF_TACLS(x) ((x)<<8)
57#define S3C2410_NFCONF_TWRPH0(x) ((x)<<4)
58#define S3C2410_NFCONF_TWRPH1(x) ((x)<<0)
59
60#define S3C2410_NFSTAT_BUSY (1<<0)
61
62#define S3C2440_NFCONF_BUSWIDTH_8 (0<<0)
63#define S3C2440_NFCONF_BUSWIDTH_16 (1<<0)
64#define S3C2440_NFCONF_ADVFLASH (1<<3)
65#define S3C2440_NFCONF_TACLS(x) ((x)<<12)
66#define S3C2440_NFCONF_TWRPH0(x) ((x)<<8)
67#define S3C2440_NFCONF_TWRPH1(x) ((x)<<4)
68
69#define S3C2440_NFCONT_LOCKTIGHT (1<<13)
70#define S3C2440_NFCONT_SOFTLOCK (1<<12)
71#define S3C2440_NFCONT_ILLEGALACC_EN (1<<10)
72#define S3C2440_NFCONT_RNBINT_EN (1<<9)
73#define S3C2440_NFCONT_RN_FALLING (1<<8)
74#define S3C2440_NFCONT_SPARE_ECCLOCK (1<<6)
75#define S3C2440_NFCONT_MAIN_ECCLOCK (1<<5)
76#define S3C2440_NFCONT_INITECC (1<<4)
77#define S3C2440_NFCONT_nFCE (1<<1)
78#define S3C2440_NFCONT_ENABLE (1<<0)
79
80#define S3C2440_NFSTAT_READY (1<<0)
81#define S3C2440_NFSTAT_nCE (1<<1)
82#define S3C2440_NFSTAT_RnB_CHANGE (1<<2)
83#define S3C2440_NFSTAT_ILLEGAL_ACCESS (1<<3)
84
85#define S3C2412_NFCONF_NANDBOOT (1<<31)
86#define S3C2412_NFCONF_ECCCLKCON (1<<30)
87#define S3C2412_NFCONF_ECC_MLC (1<<24)
88#define S3C2412_NFCONF_TACLS_MASK (7<<12) /* 1 extra bit of Tacls */
89
90#define S3C2412_NFCONT_ECC4_DIRWR (1<<18)
91#define S3C2412_NFCONT_LOCKTIGHT (1<<17)
92#define S3C2412_NFCONT_SOFTLOCK (1<<16)
93#define S3C2412_NFCONT_ECC4_ENCINT (1<<13)
94#define S3C2412_NFCONT_ECC4_DECINT (1<<12)
95#define S3C2412_NFCONT_MAIN_ECC_LOCK (1<<7)
96#define S3C2412_NFCONT_INIT_MAIN_ECC (1<<5)
97#define S3C2412_NFCONT_nFCE1 (1<<2)
98#define S3C2412_NFCONT_nFCE0 (1<<1)
99
100#define S3C2412_NFSTAT_ECC_ENCDONE (1<<7)
101#define S3C2412_NFSTAT_ECC_DECDONE (1<<6)
102#define S3C2412_NFSTAT_ILLEGAL_ACCESS (1<<5)
103#define S3C2412_NFSTAT_RnB_CHANGE (1<<4)
104#define S3C2412_NFSTAT_nFCE1 (1<<3)
105#define S3C2412_NFSTAT_nFCE0 (1<<2)
106#define S3C2412_NFSTAT_Res1 (1<<1)
107#define S3C2412_NFSTAT_READY (1<<0)
108
109#define S3C2412_NFECCERR_SERRDATA(x) (((x) >> 21) & 0xf)
110#define S3C2412_NFECCERR_SERRBIT(x) (((x) >> 18) & 0x7)
111#define S3C2412_NFECCERR_MERRDATA(x) (((x) >> 7) & 0x3ff)
112#define S3C2412_NFECCERR_MERRBIT(x) (((x) >> 4) & 0x7)
113#define S3C2412_NFECCERR_SPARE_ERR(x) (((x) >> 2) & 0x3)
114#define S3C2412_NFECCERR_MAIN_ERR(x) (((x) >> 2) & 0x3)
115#define S3C2412_NFECCERR_NONE (0)
116#define S3C2412_NFECCERR_1BIT (1)
117#define S3C2412_NFECCERR_MULTIBIT (2)
118#define S3C2412_NFECCERR_ECCAREA (3)
119
120
121
122#endif /* __ASM_ARM_REGS_NAND */
123
diff --git a/include/asm-arm/plat-s3c/regs-rtc.h b/include/asm-arm/plat-s3c/regs-rtc.h
deleted file mode 100644
index d5837cf8e40..00000000000
--- a/include/asm-arm/plat-s3c/regs-rtc.h
+++ /dev/null
@@ -1,61 +0,0 @@
1/* arch/arm/mach-s3c2410/include/mach/regs-rtc.h
2 *
3 * Copyright (c) 2003 Simtec Electronics <linux@simtec.co.uk>
4 * http://www.simtec.co.uk/products/SWLINUX/
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 * S3C2410 Internal RTC register definition
11*/
12
13#ifndef __ASM_ARCH_REGS_RTC_H
14#define __ASM_ARCH_REGS_RTC_H __FILE__
15
16#define S3C2410_RTCREG(x) (x)
17
18#define S3C2410_RTCCON S3C2410_RTCREG(0x40)
19#define S3C2410_RTCCON_RTCEN (1<<0)
20#define S3C2410_RTCCON_CLKSEL (1<<1)
21#define S3C2410_RTCCON_CNTSEL (1<<2)
22#define S3C2410_RTCCON_CLKRST (1<<3)
23
24#define S3C2410_TICNT S3C2410_RTCREG(0x44)
25#define S3C2410_TICNT_ENABLE (1<<7)
26
27#define S3C2410_RTCALM S3C2410_RTCREG(0x50)
28#define S3C2410_RTCALM_ALMEN (1<<6)
29#define S3C2410_RTCALM_YEAREN (1<<5)
30#define S3C2410_RTCALM_MONEN (1<<4)
31#define S3C2410_RTCALM_DAYEN (1<<3)
32#define S3C2410_RTCALM_HOUREN (1<<2)
33#define S3C2410_RTCALM_MINEN (1<<1)
34#define S3C2410_RTCALM_SECEN (1<<0)
35
36#define S3C2410_RTCALM_ALL \
37 S3C2410_RTCALM_ALMEN | S3C2410_RTCALM_YEAREN | S3C2410_RTCALM_MONEN |\
38 S3C2410_RTCALM_DAYEN | S3C2410_RTCALM_HOUREN | S3C2410_RTCALM_MINEN |\
39 S3C2410_RTCALM_SECEN
40
41
42#define S3C2410_ALMSEC S3C2410_RTCREG(0x54)
43#define S3C2410_ALMMIN S3C2410_RTCREG(0x58)
44#define S3C2410_ALMHOUR S3C2410_RTCREG(0x5c)
45
46#define S3C2410_ALMDATE S3C2410_RTCREG(0x60)
47#define S3C2410_ALMMON S3C2410_RTCREG(0x64)
48#define S3C2410_ALMYEAR S3C2410_RTCREG(0x68)
49
50#define S3C2410_RTCRST S3C2410_RTCREG(0x6c)
51
52#define S3C2410_RTCSEC S3C2410_RTCREG(0x70)
53#define S3C2410_RTCMIN S3C2410_RTCREG(0x74)
54#define S3C2410_RTCHOUR S3C2410_RTCREG(0x78)
55#define S3C2410_RTCDATE S3C2410_RTCREG(0x7c)
56#define S3C2410_RTCDAY S3C2410_RTCREG(0x80)
57#define S3C2410_RTCMON S3C2410_RTCREG(0x84)
58#define S3C2410_RTCYEAR S3C2410_RTCREG(0x88)
59
60
61#endif /* __ASM_ARCH_REGS_RTC_H */
diff --git a/include/asm-arm/plat-s3c/regs-watchdog.h b/include/asm-arm/plat-s3c/regs-watchdog.h
deleted file mode 100644
index 4938492470f..00000000000
--- a/include/asm-arm/plat-s3c/regs-watchdog.h
+++ /dev/null
@@ -1,41 +0,0 @@
1/* arch/arm/mach-s3c2410/include/mach/regs-watchdog.h
2 *
3 * Copyright (c) 2003 Simtec Electronics <linux@simtec.co.uk>
4 * http://www.simtec.co.uk/products/SWLINUX/
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 * S3C2410 Watchdog timer control
11*/
12
13
14#ifndef __ASM_ARCH_REGS_WATCHDOG_H
15#define __ASM_ARCH_REGS_WATCHDOG_H
16
17#define S3C_WDOGREG(x) ((x) + S3C_VA_WATCHDOG)
18
19#define S3C2410_WTCON S3C_WDOGREG(0x00)
20#define S3C2410_WTDAT S3C_WDOGREG(0x04)
21#define S3C2410_WTCNT S3C_WDOGREG(0x08)
22
23/* the watchdog can either generate a reset pulse, or an
24 * interrupt.
25 */
26
27#define S3C2410_WTCON_RSTEN (0x01)
28#define S3C2410_WTCON_INTEN (1<<2)
29#define S3C2410_WTCON_ENABLE (1<<5)
30
31#define S3C2410_WTCON_DIV16 (0<<3)
32#define S3C2410_WTCON_DIV32 (1<<3)
33#define S3C2410_WTCON_DIV64 (2<<3)
34#define S3C2410_WTCON_DIV128 (3<<3)
35
36#define S3C2410_WTCON_PRESCALE(x) ((x) << 8)
37#define S3C2410_WTCON_PRESCALE_MASK (0xff00)
38
39#endif /* __ASM_ARCH_REGS_WATCHDOG_H */
40
41
diff --git a/include/asm-arm/plat-s3c24xx/mci.h b/include/asm-arm/plat-s3c24xx/mci.h
deleted file mode 100644
index 2d0852ac3b2..00000000000
--- a/include/asm-arm/plat-s3c24xx/mci.h
+++ /dev/null
@@ -1,15 +0,0 @@
1#ifndef _ARCH_MCI_H
2#define _ARCH_MCI_H
3
4struct s3c24xx_mci_pdata {
5 unsigned int wprotect_invert : 1;
6 unsigned int detect_invert : 1; /* set => detect active high. */
7
8 unsigned int gpio_detect;
9 unsigned int gpio_wprotect;
10 unsigned long ocr_avail;
11 void (*set_power)(unsigned char power_mode,
12 unsigned short vdd);
13};
14
15#endif /* _ARCH_NCI_H */
diff --git a/include/asm-arm/plat-s3c24xx/regs-spi.h b/include/asm-arm/plat-s3c24xx/regs-spi.h
deleted file mode 100644
index 2b35479ee35..00000000000
--- a/include/asm-arm/plat-s3c24xx/regs-spi.h
+++ /dev/null
@@ -1,82 +0,0 @@
1/* arch/arm/mach-s3c2410/include/mach/regs-spi.h
2 *
3 * Copyright (c) 2004 Fetron GmbH
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9 * S3C2410 SPI register definition
10*/
11
12#ifndef __ASM_ARCH_REGS_SPI_H
13#define __ASM_ARCH_REGS_SPI_H
14
15#define S3C2410_SPI1 (0x20)
16#define S3C2412_SPI1 (0x100)
17
18#define S3C2410_SPCON (0x00)
19
20#define S3C2412_SPCON_RXFIFO_RB2 (0<<14)
21#define S3C2412_SPCON_RXFIFO_RB4 (1<<14)
22#define S3C2412_SPCON_RXFIFO_RB12 (2<<14)
23#define S3C2412_SPCON_RXFIFO_RB14 (3<<14)
24#define S3C2412_SPCON_TXFIFO_RB2 (0<<12)
25#define S3C2412_SPCON_TXFIFO_RB4 (1<<12)
26#define S3C2412_SPCON_TXFIFO_RB12 (2<<12)
27#define S3C2412_SPCON_TXFIFO_RB14 (3<<12)
28#define S3C2412_SPCON_RXFIFO_RESET (1<<11) /* RxFIFO reset */
29#define S3C2412_SPCON_TXFIFO_RESET (1<<10) /* TxFIFO reset */
30#define S3C2412_SPCON_RXFIFO_EN (1<<9) /* RxFIFO Enable */
31#define S3C2412_SPCON_TXFIFO_EN (1<<8) /* TxFIFO Enable */
32
33#define S3C2412_SPCON_DIRC_RX (1<<7)
34
35#define S3C2410_SPCON_SMOD_DMA (2<<5) /* DMA mode */
36#define S3C2410_SPCON_SMOD_INT (1<<5) /* interrupt mode */
37#define S3C2410_SPCON_SMOD_POLL (0<<5) /* polling mode */
38#define S3C2410_SPCON_ENSCK (1<<4) /* Enable SCK */
39#define S3C2410_SPCON_MSTR (1<<3) /* Master/Slave select
40 0: slave, 1: master */
41#define S3C2410_SPCON_CPOL_HIGH (1<<2) /* Clock polarity select */
42#define S3C2410_SPCON_CPOL_LOW (0<<2) /* Clock polarity select */
43
44#define S3C2410_SPCON_CPHA_FMTB (1<<1) /* Clock Phase Select */
45#define S3C2410_SPCON_CPHA_FMTA (0<<1) /* Clock Phase Select */
46
47#define S3C2410_SPCON_TAGD (1<<0) /* Tx auto garbage data mode */
48
49
50#define S3C2410_SPSTA (0x04)
51
52#define S3C2412_SPSTA_RXFIFO_AE (1<<11)
53#define S3C2412_SPSTA_TXFIFO_AE (1<<10)
54#define S3C2412_SPSTA_RXFIFO_ERROR (1<<9)
55#define S3C2412_SPSTA_TXFIFO_ERROR (1<<8)
56#define S3C2412_SPSTA_RXFIFO_FIFO (1<<7)
57#define S3C2412_SPSTA_RXFIFO_EMPTY (1<<6)
58#define S3C2412_SPSTA_TXFIFO_NFULL (1<<5)
59#define S3C2412_SPSTA_TXFIFO_EMPTY (1<<4)
60
61#define S3C2410_SPSTA_DCOL (1<<2) /* Data Collision Error */
62#define S3C2410_SPSTA_MULD (1<<1) /* Multi Master Error */
63#define S3C2410_SPSTA_READY (1<<0) /* Data Tx/Rx ready */
64#define S3C2412_SPSTA_READY_ORG (1<<3)
65
66#define S3C2410_SPPIN (0x08)
67
68#define S3C2410_SPPIN_ENMUL (1<<2) /* Multi Master Error detect */
69#define S3C2410_SPPIN_RESERVED (1<<1)
70#define S3C2400_SPPIN_nCS (1<<1) /* SPI Card Select */
71#define S3C2410_SPPIN_KEEP (1<<0) /* Master Out keep */
72
73#define S3C2410_SPPRE (0x0C)
74#define S3C2410_SPTDAT (0x10)
75#define S3C2410_SPRDAT (0x14)
76
77#define S3C2412_TXFIFO (0x18)
78#define S3C2412_RXFIFO (0x18)
79#define S3C2412_SPFIC (0x24)
80
81
82#endif /* __ASM_ARCH_REGS_SPI_H */
diff --git a/include/asm-arm/plat-s3c24xx/regs-udc.h b/include/asm-arm/plat-s3c24xx/regs-udc.h
deleted file mode 100644
index f0dd4a41b37..00000000000
--- a/include/asm-arm/plat-s3c24xx/regs-udc.h
+++ /dev/null
@@ -1,153 +0,0 @@
1/* arch/arm/mach-s3c2410/include/mach/regs-udc.h
2 *
3 * Copyright (C) 2004 Herbert Poetzl <herbert@13thfloor.at>
4 *
5 * This include file is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 2 of
8 * the License, or (at your option) any later version.
9*/
10
11#ifndef __ASM_ARCH_REGS_UDC_H
12#define __ASM_ARCH_REGS_UDC_H
13
14#define S3C2410_USBDREG(x) (x)
15
16#define S3C2410_UDC_FUNC_ADDR_REG S3C2410_USBDREG(0x0140)
17#define S3C2410_UDC_PWR_REG S3C2410_USBDREG(0x0144)
18#define S3C2410_UDC_EP_INT_REG S3C2410_USBDREG(0x0148)
19
20#define S3C2410_UDC_USB_INT_REG S3C2410_USBDREG(0x0158)
21#define S3C2410_UDC_EP_INT_EN_REG S3C2410_USBDREG(0x015c)
22
23#define S3C2410_UDC_USB_INT_EN_REG S3C2410_USBDREG(0x016c)
24
25#define S3C2410_UDC_FRAME_NUM1_REG S3C2410_USBDREG(0x0170)
26#define S3C2410_UDC_FRAME_NUM2_REG S3C2410_USBDREG(0x0174)
27
28#define S3C2410_UDC_EP0_FIFO_REG S3C2410_USBDREG(0x01c0)
29#define S3C2410_UDC_EP1_FIFO_REG S3C2410_USBDREG(0x01c4)
30#define S3C2410_UDC_EP2_FIFO_REG S3C2410_USBDREG(0x01c8)
31#define S3C2410_UDC_EP3_FIFO_REG S3C2410_USBDREG(0x01cc)
32#define S3C2410_UDC_EP4_FIFO_REG S3C2410_USBDREG(0x01d0)
33
34#define S3C2410_UDC_EP1_DMA_CON S3C2410_USBDREG(0x0200)
35#define S3C2410_UDC_EP1_DMA_UNIT S3C2410_USBDREG(0x0204)
36#define S3C2410_UDC_EP1_DMA_FIFO S3C2410_USBDREG(0x0208)
37#define S3C2410_UDC_EP1_DMA_TTC_L S3C2410_USBDREG(0x020c)
38#define S3C2410_UDC_EP1_DMA_TTC_M S3C2410_USBDREG(0x0210)
39#define S3C2410_UDC_EP1_DMA_TTC_H S3C2410_USBDREG(0x0214)
40
41#define S3C2410_UDC_EP2_DMA_CON S3C2410_USBDREG(0x0218)
42#define S3C2410_UDC_EP2_DMA_UNIT S3C2410_USBDREG(0x021c)
43#define S3C2410_UDC_EP2_DMA_FIFO S3C2410_USBDREG(0x0220)
44#define S3C2410_UDC_EP2_DMA_TTC_L S3C2410_USBDREG(0x0224)
45#define S3C2410_UDC_EP2_DMA_TTC_M S3C2410_USBDREG(0x0228)
46#define S3C2410_UDC_EP2_DMA_TTC_H S3C2410_USBDREG(0x022c)
47
48#define S3C2410_UDC_EP3_DMA_CON S3C2410_USBDREG(0x0240)
49#define S3C2410_UDC_EP3_DMA_UNIT S3C2410_USBDREG(0x0244)
50#define S3C2410_UDC_EP3_DMA_FIFO S3C2410_USBDREG(0x0248)
51#define S3C2410_UDC_EP3_DMA_TTC_L S3C2410_USBDREG(0x024c)
52#define S3C2410_UDC_EP3_DMA_TTC_M S3C2410_USBDREG(0x0250)
53#define S3C2410_UDC_EP3_DMA_TTC_H S3C2410_USBDREG(0x0254)
54
55#define S3C2410_UDC_EP4_DMA_CON S3C2410_USBDREG(0x0258)
56#define S3C2410_UDC_EP4_DMA_UNIT S3C2410_USBDREG(0x025c)
57#define S3C2410_UDC_EP4_DMA_FIFO S3C2410_USBDREG(0x0260)
58#define S3C2410_UDC_EP4_DMA_TTC_L S3C2410_USBDREG(0x0264)
59#define S3C2410_UDC_EP4_DMA_TTC_M S3C2410_USBDREG(0x0268)
60#define S3C2410_UDC_EP4_DMA_TTC_H S3C2410_USBDREG(0x026c)
61
62#define S3C2410_UDC_INDEX_REG S3C2410_USBDREG(0x0178)
63
64/* indexed registers */
65
66#define S3C2410_UDC_MAXP_REG S3C2410_USBDREG(0x0180)
67
68#define S3C2410_UDC_EP0_CSR_REG S3C2410_USBDREG(0x0184)
69
70#define S3C2410_UDC_IN_CSR1_REG S3C2410_USBDREG(0x0184)
71#define S3C2410_UDC_IN_CSR2_REG S3C2410_USBDREG(0x0188)
72
73#define S3C2410_UDC_OUT_CSR1_REG S3C2410_USBDREG(0x0190)
74#define S3C2410_UDC_OUT_CSR2_REG S3C2410_USBDREG(0x0194)
75#define S3C2410_UDC_OUT_FIFO_CNT1_REG S3C2410_USBDREG(0x0198)
76#define S3C2410_UDC_OUT_FIFO_CNT2_REG S3C2410_USBDREG(0x019c)
77
78#define S3C2410_UDC_FUNCADDR_UPDATE (1<<7)
79
80#define S3C2410_UDC_PWR_ISOUP (1<<7) // R/W
81#define S3C2410_UDC_PWR_RESET (1<<3) // R
82#define S3C2410_UDC_PWR_RESUME (1<<2) // R/W
83#define S3C2410_UDC_PWR_SUSPEND (1<<1) // R
84#define S3C2410_UDC_PWR_ENSUSPEND (1<<0) // R/W
85
86#define S3C2410_UDC_PWR_DEFAULT 0x00
87
88#define S3C2410_UDC_INT_EP4 (1<<4) // R/W (clear only)
89#define S3C2410_UDC_INT_EP3 (1<<3) // R/W (clear only)
90#define S3C2410_UDC_INT_EP2 (1<<2) // R/W (clear only)
91#define S3C2410_UDC_INT_EP1 (1<<1) // R/W (clear only)
92#define S3C2410_UDC_INT_EP0 (1<<0) // R/W (clear only)
93
94#define S3C2410_UDC_USBINT_RESET (1<<2) // R/W (clear only)
95#define S3C2410_UDC_USBINT_RESUME (1<<1) // R/W (clear only)
96#define S3C2410_UDC_USBINT_SUSPEND (1<<0) // R/W (clear only)
97
98#define S3C2410_UDC_INTE_EP4 (1<<4) // R/W
99#define S3C2410_UDC_INTE_EP3 (1<<3) // R/W
100#define S3C2410_UDC_INTE_EP2 (1<<2) // R/W
101#define S3C2410_UDC_INTE_EP1 (1<<1) // R/W
102#define S3C2410_UDC_INTE_EP0 (1<<0) // R/W
103
104#define S3C2410_UDC_USBINTE_RESET (1<<2) // R/W
105#define S3C2410_UDC_USBINTE_SUSPEND (1<<0) // R/W
106
107
108#define S3C2410_UDC_INDEX_EP0 (0x00)
109#define S3C2410_UDC_INDEX_EP1 (0x01) // ??
110#define S3C2410_UDC_INDEX_EP2 (0x02) // ??
111#define S3C2410_UDC_INDEX_EP3 (0x03) // ??
112#define S3C2410_UDC_INDEX_EP4 (0x04) // ??
113
114#define S3C2410_UDC_ICSR1_CLRDT (1<<6) // R/W
115#define S3C2410_UDC_ICSR1_SENTSTL (1<<5) // R/W (clear only)
116#define S3C2410_UDC_ICSR1_SENDSTL (1<<4) // R/W
117#define S3C2410_UDC_ICSR1_FFLUSH (1<<3) // W (set only)
118#define S3C2410_UDC_ICSR1_UNDRUN (1<<2) // R/W (clear only)
119#define S3C2410_UDC_ICSR1_PKTRDY (1<<0) // R/W (set only)
120
121#define S3C2410_UDC_ICSR2_AUTOSET (1<<7) // R/W
122#define S3C2410_UDC_ICSR2_ISO (1<<6) // R/W
123#define S3C2410_UDC_ICSR2_MODEIN (1<<5) // R/W
124#define S3C2410_UDC_ICSR2_DMAIEN (1<<4) // R/W
125
126#define S3C2410_UDC_OCSR1_CLRDT (1<<7) // R/W
127#define S3C2410_UDC_OCSR1_SENTSTL (1<<6) // R/W (clear only)
128#define S3C2410_UDC_OCSR1_SENDSTL (1<<5) // R/W
129#define S3C2410_UDC_OCSR1_FFLUSH (1<<4) // R/W
130#define S3C2410_UDC_OCSR1_DERROR (1<<3) // R
131#define S3C2410_UDC_OCSR1_OVRRUN (1<<2) // R/W (clear only)
132#define S3C2410_UDC_OCSR1_PKTRDY (1<<0) // R/W (clear only)
133
134#define S3C2410_UDC_OCSR2_AUTOCLR (1<<7) // R/W
135#define S3C2410_UDC_OCSR2_ISO (1<<6) // R/W
136#define S3C2410_UDC_OCSR2_DMAIEN (1<<5) // R/W
137
138#define S3C2410_UDC_EP0_CSR_OPKRDY (1<<0)
139#define S3C2410_UDC_EP0_CSR_IPKRDY (1<<1)
140#define S3C2410_UDC_EP0_CSR_SENTSTL (1<<2)
141#define S3C2410_UDC_EP0_CSR_DE (1<<3)
142#define S3C2410_UDC_EP0_CSR_SE (1<<4)
143#define S3C2410_UDC_EP0_CSR_SENDSTL (1<<5)
144#define S3C2410_UDC_EP0_CSR_SOPKTRDY (1<<6)
145#define S3C2410_UDC_EP0_CSR_SSE (1<<7)
146
147#define S3C2410_UDC_MAXP_8 (1<<0)
148#define S3C2410_UDC_MAXP_16 (1<<1)
149#define S3C2410_UDC_MAXP_32 (1<<2)
150#define S3C2410_UDC_MAXP_64 (1<<3)
151
152
153#endif
diff --git a/include/asm-arm/plat-s3c24xx/udc.h b/include/asm-arm/plat-s3c24xx/udc.h
deleted file mode 100644
index 546bb4008f4..00000000000
--- a/include/asm-arm/plat-s3c24xx/udc.h
+++ /dev/null
@@ -1,36 +0,0 @@
1/* arch/arm/mach-s3c2410/include/mach/udc.h
2 *
3 * Copyright (c) 2005 Arnaud Patard <arnaud.patard@rtp-net.org>
4 *
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 * Changelog:
12 * 14-Mar-2005 RTP Created file
13 * 02-Aug-2005 RTP File rename
14 * 07-Sep-2005 BJD Minor cleanups, changed cmd to enum
15 * 18-Jan-2007 HMW Add per-platform vbus_draw function
16*/
17
18#ifndef __ASM_ARM_ARCH_UDC_H
19#define __ASM_ARM_ARCH_UDC_H
20
21enum s3c2410_udc_cmd_e {
22 S3C2410_UDC_P_ENABLE = 1, /* Pull-up enable */
23 S3C2410_UDC_P_DISABLE = 2, /* Pull-up disable */
24 S3C2410_UDC_P_RESET = 3, /* UDC reset, in case of */
25};
26
27struct s3c2410_udc_mach_info {
28 void (*udc_command)(enum s3c2410_udc_cmd_e);
29 void (*vbus_draw)(unsigned int ma);
30 unsigned int vbus_pin;
31 unsigned char vbus_pin_inverted;
32};
33
34extern void __init s3c24xx_udc_set_platdata(struct s3c2410_udc_mach_info *);
35
36#endif /* __ASM_ARM_ARCH_UDC_H */
diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index 12c07c1866b..8af276361bf 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -8,9 +8,17 @@
8#ifdef CONFIG_GENERIC_BUG 8#ifdef CONFIG_GENERIC_BUG
9#ifndef __ASSEMBLY__ 9#ifndef __ASSEMBLY__
10struct bug_entry { 10struct bug_entry {
11#ifndef CONFIG_GENERIC_BUG_RELATIVE_POINTERS
11 unsigned long bug_addr; 12 unsigned long bug_addr;
13#else
14 signed int bug_addr_disp;
15#endif
12#ifdef CONFIG_DEBUG_BUGVERBOSE 16#ifdef CONFIG_DEBUG_BUGVERBOSE
17#ifndef CONFIG_GENERIC_BUG_RELATIVE_POINTERS
13 const char *file; 18 const char *file;
19#else
20 signed int file_disp;
21#endif
14 unsigned short line; 22 unsigned short line;
15#endif 23#endif
16 unsigned short flags; 24 unsigned short flags;
@@ -33,15 +41,14 @@ struct bug_entry {
33 41
34#ifndef __WARN 42#ifndef __WARN
35#ifndef __ASSEMBLY__ 43#ifndef __ASSEMBLY__
36extern void warn_on_slowpath(const char *file, const int line);
37extern void warn_slowpath(const char *file, const int line, 44extern void warn_slowpath(const char *file, const int line,
38 const char *fmt, ...) __attribute__((format(printf, 3, 4))); 45 const char *fmt, ...) __attribute__((format(printf, 3, 4)));
39#define WANT_WARN_ON_SLOWPATH 46#define WANT_WARN_ON_SLOWPATH
40#endif 47#endif
41#define __WARN() warn_on_slowpath(__FILE__, __LINE__) 48#define __WARN() warn_slowpath(__FILE__, __LINE__, NULL)
42#define __WARN_printf(arg...) warn_slowpath(__FILE__, __LINE__, arg) 49#define __WARN_printf(arg...) warn_slowpath(__FILE__, __LINE__, arg)
43#else 50#else
44#define __WARN_printf(arg...) do { printk(arg); __WARN(); } while (0) 51#define __WARN_printf(arg...) do { printk(arg); __WARN(); } while (0)
45#endif 52#endif
46 53
47#ifndef WARN_ON 54#ifndef WARN_ON
diff --git a/include/asm-generic/memory_model.h b/include/asm-generic/memory_model.h
index 18546d8eb78..36fa286adad 100644
--- a/include/asm-generic/memory_model.h
+++ b/include/asm-generic/memory_model.h
@@ -49,7 +49,7 @@
49 49
50/* memmap is virtually contigious. */ 50/* memmap is virtually contigious. */
51#define __pfn_to_page(pfn) (vmemmap + (pfn)) 51#define __pfn_to_page(pfn) (vmemmap + (pfn))
52#define __page_to_pfn(page) ((page) - vmemmap) 52#define __page_to_pfn(page) (unsigned long)((page) - vmemmap)
53 53
54#elif defined(CONFIG_SPARSEMEM) 54#elif defined(CONFIG_SPARSEMEM)
55/* 55/*
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
index ef87f889ef6..72ebe91005a 100644
--- a/include/asm-generic/pgtable.h
+++ b/include/asm-generic/pgtable.h
@@ -129,6 +129,10 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addres
129#define move_pte(pte, prot, old_addr, new_addr) (pte) 129#define move_pte(pte, prot, old_addr, new_addr) (pte)
130#endif 130#endif
131 131
132#ifndef pgprot_writecombine
133#define pgprot_writecombine pgprot_noncached
134#endif
135
132/* 136/*
133 * When walking page tables, get the address of the next boundary, 137 * When walking page tables, get the address of the next boundary,
134 * or the end address of the range if that comes earlier. Although no 138 * or the end address of the range if that comes earlier. Although no
@@ -289,6 +293,52 @@ static inline void ptep_modify_prot_commit(struct mm_struct *mm,
289#define arch_flush_lazy_cpu_mode() do {} while (0) 293#define arch_flush_lazy_cpu_mode() do {} while (0)
290#endif 294#endif
291 295
296#ifndef __HAVE_PFNMAP_TRACKING
297/*
298 * Interface that can be used by architecture code to keep track of
299 * memory type of pfn mappings (remap_pfn_range, vm_insert_pfn)
300 *
301 * track_pfn_vma_new is called when a _new_ pfn mapping is being established
302 * for physical range indicated by pfn and size.
303 */
304static inline int track_pfn_vma_new(struct vm_area_struct *vma, pgprot_t prot,
305 unsigned long pfn, unsigned long size)
306{
307 return 0;
308}
309
310/*
311 * Interface that can be used by architecture code to keep track of
312 * memory type of pfn mappings (remap_pfn_range, vm_insert_pfn)
313 *
314 * track_pfn_vma_copy is called when vma that is covering the pfnmap gets
315 * copied through copy_page_range().
316 */
317static inline int track_pfn_vma_copy(struct vm_area_struct *vma)
318{
319 return 0;
320}
321
322/*
323 * Interface that can be used by architecture code to keep track of
324 * memory type of pfn mappings (remap_pfn_range, vm_insert_pfn)
325 *
326 * untrack_pfn_vma is called while unmapping a pfnmap for a region.
327 * untrack can be called for a specific region indicated by pfn and size or
328 * can be for the entire vma (in which case size can be zero).
329 */
330static inline void untrack_pfn_vma(struct vm_area_struct *vma,
331 unsigned long pfn, unsigned long size)
332{
333}
334#else
335extern int track_pfn_vma_new(struct vm_area_struct *vma, pgprot_t prot,
336 unsigned long pfn, unsigned long size);
337extern int track_pfn_vma_copy(struct vm_area_struct *vma);
338extern void untrack_pfn_vma(struct vm_area_struct *vma, unsigned long pfn,
339 unsigned long size);
340#endif
341
292#endif /* !__ASSEMBLY__ */ 342#endif /* !__ASSEMBLY__ */
293 343
294#endif /* _ASM_GENERIC_PGTABLE_H */ 344#endif /* _ASM_GENERIC_PGTABLE_H */
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index eba835a2c2c..c61fab1dd2f 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -288,6 +288,16 @@
288 *(.kprobes.text) \ 288 *(.kprobes.text) \
289 VMLINUX_SYMBOL(__kprobes_text_end) = .; 289 VMLINUX_SYMBOL(__kprobes_text_end) = .;
290 290
291#ifdef CONFIG_FUNCTION_GRAPH_TRACER
292#define IRQENTRY_TEXT \
293 ALIGN_FUNCTION(); \
294 VMLINUX_SYMBOL(__irqentry_text_start) = .; \
295 *(.irqentry.text) \
296 VMLINUX_SYMBOL(__irqentry_text_end) = .;
297#else
298#define IRQENTRY_TEXT
299#endif
300
291/* Section used for early init (in .S files) */ 301/* Section used for early init (in .S files) */
292#define HEAD_TEXT *(.head.text) 302#define HEAD_TEXT *(.head.text)
293 303
diff --git a/include/asm-m68k/bitops.h b/include/asm-m68k/bitops.h
index 3e8106442d5..9bde784e7ba 100644
--- a/include/asm-m68k/bitops.h
+++ b/include/asm-m68k/bitops.h
@@ -315,6 +315,11 @@ static inline int fls(int x)
315 return 32 - cnt; 315 return 32 - cnt;
316} 316}
317 317
318static inline int __fls(int x)
319{
320 return fls(x) - 1;
321}
322
318#include <asm-generic/bitops/fls64.h> 323#include <asm-generic/bitops/fls64.h>
319#include <asm-generic/bitops/sched.h> 324#include <asm-generic/bitops/sched.h>
320#include <asm-generic/bitops/hweight.h> 325#include <asm-generic/bitops/hweight.h>
diff --git a/include/asm-m68k/byteorder.h b/include/asm-m68k/byteorder.h
index 81d420b35c8..b354acdafec 100644
--- a/include/asm-m68k/byteorder.h
+++ b/include/asm-m68k/byteorder.h
@@ -4,22 +4,16 @@
4#include <asm/types.h> 4#include <asm/types.h>
5#include <linux/compiler.h> 5#include <linux/compiler.h>
6 6
7#ifdef __GNUC__ 7#define __BIG_ENDIAN
8#define __SWAB_64_THRU_32__
8 9
9static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 val) 10static inline __attribute_const__ __u32 __arch_swab32(__u32 val)
10{ 11{
11 __asm__("rolw #8,%0; swap %0; rolw #8,%0" : "=d" (val) : "0" (val)); 12 __asm__("rolw #8,%0; swap %0; rolw #8,%0" : "=d" (val) : "0" (val));
12 return val; 13 return val;
13} 14}
14#define __arch__swab32(x) ___arch__swab32(x) 15#define __arch_swab32 __arch_swab32
15 16
16#endif 17#include <linux/byteorder.h>
17
18#if defined(__GNUC__) && !defined(__STRICT_ANSI__) || defined(__KERNEL__)
19# define __BYTEORDER_HAS_U64__
20# define __SWAB_64_THRU_32__
21#endif
22
23#include <linux/byteorder/big_endian.h>
24 18
25#endif /* _M68K_BYTEORDER_H */ 19#endif /* _M68K_BYTEORDER_H */
diff --git a/include/asm-m68k/machw.h b/include/asm-m68k/machw.h
index 35624998291..2b4de0c2ce4 100644
--- a/include/asm-m68k/machw.h
+++ b/include/asm-m68k/machw.h
@@ -26,28 +26,6 @@
26#include <linux/types.h> 26#include <linux/types.h>
27 27
28#if 0 28#if 0
29/* Mac SCSI Controller 5380 */
30
31#define MAC_5380_BAS (0x50F10000) /* This is definitely wrong!! */
32struct MAC_5380 {
33 u_char scsi_data;
34 u_char char_dummy1;
35 u_char scsi_icr;
36 u_char char_dummy2;
37 u_char scsi_mode;
38 u_char char_dummy3;
39 u_char scsi_tcr;
40 u_char char_dummy4;
41 u_char scsi_idstat;
42 u_char char_dummy5;
43 u_char scsi_dmastat;
44 u_char char_dummy6;
45 u_char scsi_targrcv;
46 u_char char_dummy7;
47 u_char scsi_inircv;
48};
49#define mac_scsi ((*(volatile struct MAC_5380 *)MAC_5380_BAS))
50
51/* 29/*
52** SCC Z8530 30** SCC Z8530
53*/ 31*/
diff --git a/include/crypto/aes.h b/include/crypto/aes.h
index 40008d67ee3..656a4c66a56 100644
--- a/include/crypto/aes.h
+++ b/include/crypto/aes.h
@@ -23,10 +23,10 @@ struct crypto_aes_ctx {
23 u32 key_dec[AES_MAX_KEYLENGTH_U32]; 23 u32 key_dec[AES_MAX_KEYLENGTH_U32];
24}; 24};
25 25
26extern u32 crypto_ft_tab[4][256]; 26extern const u32 crypto_ft_tab[4][256];
27extern u32 crypto_fl_tab[4][256]; 27extern const u32 crypto_fl_tab[4][256];
28extern u32 crypto_it_tab[4][256]; 28extern const u32 crypto_it_tab[4][256];
29extern u32 crypto_il_tab[4][256]; 29extern const u32 crypto_il_tab[4][256];
30 30
31int crypto_aes_set_key(struct crypto_tfm *tfm, const u8 *in_key, 31int crypto_aes_set_key(struct crypto_tfm *tfm, const u8 *in_key,
32 unsigned int key_len); 32 unsigned int key_len);
diff --git a/include/crypto/algapi.h b/include/crypto/algapi.h
index 60d06e784be..010545436ef 100644
--- a/include/crypto/algapi.h
+++ b/include/crypto/algapi.h
@@ -22,9 +22,18 @@ struct seq_file;
22 22
23struct crypto_type { 23struct crypto_type {
24 unsigned int (*ctxsize)(struct crypto_alg *alg, u32 type, u32 mask); 24 unsigned int (*ctxsize)(struct crypto_alg *alg, u32 type, u32 mask);
25 unsigned int (*extsize)(struct crypto_alg *alg,
26 const struct crypto_type *frontend);
25 int (*init)(struct crypto_tfm *tfm, u32 type, u32 mask); 27 int (*init)(struct crypto_tfm *tfm, u32 type, u32 mask);
26 void (*exit)(struct crypto_tfm *tfm); 28 int (*init_tfm)(struct crypto_tfm *tfm,
29 const struct crypto_type *frontend);
27 void (*show)(struct seq_file *m, struct crypto_alg *alg); 30 void (*show)(struct seq_file *m, struct crypto_alg *alg);
31 struct crypto_alg *(*lookup)(const char *name, u32 type, u32 mask);
32
33 unsigned int type;
34 unsigned int maskclear;
35 unsigned int maskset;
36 unsigned int tfmsize;
28}; 37};
29 38
30struct crypto_instance { 39struct crypto_instance {
@@ -239,6 +248,11 @@ static inline struct crypto_hash *crypto_spawn_hash(struct crypto_spawn *spawn)
239 return __crypto_hash_cast(crypto_spawn_tfm(spawn, type, mask)); 248 return __crypto_hash_cast(crypto_spawn_tfm(spawn, type, mask));
240} 249}
241 250
251static inline void *crypto_hash_ctx(struct crypto_hash *tfm)
252{
253 return crypto_tfm_ctx(&tfm->base);
254}
255
242static inline void *crypto_hash_ctx_aligned(struct crypto_hash *tfm) 256static inline void *crypto_hash_ctx_aligned(struct crypto_hash *tfm)
243{ 257{
244 return crypto_tfm_ctx_aligned(&tfm->base); 258 return crypto_tfm_ctx_aligned(&tfm->base);
diff --git a/include/crypto/hash.h b/include/crypto/hash.h
index ee48ef8fb2e..cd16d6e668c 100644
--- a/include/crypto/hash.h
+++ b/include/crypto/hash.h
@@ -15,10 +15,40 @@
15 15
16#include <linux/crypto.h> 16#include <linux/crypto.h>
17 17
18struct shash_desc {
19 struct crypto_shash *tfm;
20 u32 flags;
21
22 void *__ctx[] CRYPTO_MINALIGN_ATTR;
23};
24
25struct shash_alg {
26 int (*init)(struct shash_desc *desc);
27 int (*reinit)(struct shash_desc *desc);
28 int (*update)(struct shash_desc *desc, const u8 *data,
29 unsigned int len);
30 int (*final)(struct shash_desc *desc, u8 *out);
31 int (*finup)(struct shash_desc *desc, const u8 *data,
32 unsigned int len, u8 *out);
33 int (*digest)(struct shash_desc *desc, const u8 *data,
34 unsigned int len, u8 *out);
35 int (*setkey)(struct crypto_shash *tfm, const u8 *key,
36 unsigned int keylen);
37
38 unsigned int descsize;
39 unsigned int digestsize;
40
41 struct crypto_alg base;
42};
43
18struct crypto_ahash { 44struct crypto_ahash {
19 struct crypto_tfm base; 45 struct crypto_tfm base;
20}; 46};
21 47
48struct crypto_shash {
49 struct crypto_tfm base;
50};
51
22static inline struct crypto_ahash *__crypto_ahash_cast(struct crypto_tfm *tfm) 52static inline struct crypto_ahash *__crypto_ahash_cast(struct crypto_tfm *tfm)
23{ 53{
24 return (struct crypto_ahash *)tfm; 54 return (struct crypto_ahash *)tfm;
@@ -87,6 +117,11 @@ static inline unsigned int crypto_ahash_reqsize(struct crypto_ahash *tfm)
87 return crypto_ahash_crt(tfm)->reqsize; 117 return crypto_ahash_crt(tfm)->reqsize;
88} 118}
89 119
120static inline void *ahash_request_ctx(struct ahash_request *req)
121{
122 return req->__ctx;
123}
124
90static inline int crypto_ahash_setkey(struct crypto_ahash *tfm, 125static inline int crypto_ahash_setkey(struct crypto_ahash *tfm,
91 const u8 *key, unsigned int keylen) 126 const u8 *key, unsigned int keylen)
92{ 127{
@@ -101,6 +136,14 @@ static inline int crypto_ahash_digest(struct ahash_request *req)
101 return crt->digest(req); 136 return crt->digest(req);
102} 137}
103 138
139static inline void crypto_ahash_export(struct ahash_request *req, u8 *out)
140{
141 memcpy(out, ahash_request_ctx(req),
142 crypto_ahash_reqsize(crypto_ahash_reqtfm(req)));
143}
144
145int crypto_ahash_import(struct ahash_request *req, const u8 *in);
146
104static inline int crypto_ahash_init(struct ahash_request *req) 147static inline int crypto_ahash_init(struct ahash_request *req)
105{ 148{
106 struct ahash_tfm *crt = crypto_ahash_crt(crypto_ahash_reqtfm(req)); 149 struct ahash_tfm *crt = crypto_ahash_crt(crypto_ahash_reqtfm(req));
@@ -169,4 +212,86 @@ static inline void ahash_request_set_crypt(struct ahash_request *req,
169 req->result = result; 212 req->result = result;
170} 213}
171 214
215struct crypto_shash *crypto_alloc_shash(const char *alg_name, u32 type,
216 u32 mask);
217
218static inline struct crypto_tfm *crypto_shash_tfm(struct crypto_shash *tfm)
219{
220 return &tfm->base;
221}
222
223static inline void crypto_free_shash(struct crypto_shash *tfm)
224{
225 crypto_free_tfm(crypto_shash_tfm(tfm));
226}
227
228static inline unsigned int crypto_shash_alignmask(
229 struct crypto_shash *tfm)
230{
231 return crypto_tfm_alg_alignmask(crypto_shash_tfm(tfm));
232}
233
234static inline struct shash_alg *__crypto_shash_alg(struct crypto_alg *alg)
235{
236 return container_of(alg, struct shash_alg, base);
237}
238
239static inline struct shash_alg *crypto_shash_alg(struct crypto_shash *tfm)
240{
241 return __crypto_shash_alg(crypto_shash_tfm(tfm)->__crt_alg);
242}
243
244static inline unsigned int crypto_shash_digestsize(struct crypto_shash *tfm)
245{
246 return crypto_shash_alg(tfm)->digestsize;
247}
248
249static inline u32 crypto_shash_get_flags(struct crypto_shash *tfm)
250{
251 return crypto_tfm_get_flags(crypto_shash_tfm(tfm));
252}
253
254static inline void crypto_shash_set_flags(struct crypto_shash *tfm, u32 flags)
255{
256 crypto_tfm_set_flags(crypto_shash_tfm(tfm), flags);
257}
258
259static inline void crypto_shash_clear_flags(struct crypto_shash *tfm, u32 flags)
260{
261 crypto_tfm_clear_flags(crypto_shash_tfm(tfm), flags);
262}
263
264static inline unsigned int crypto_shash_descsize(struct crypto_shash *tfm)
265{
266 return crypto_shash_alg(tfm)->descsize;
267}
268
269static inline void *shash_desc_ctx(struct shash_desc *desc)
270{
271 return desc->__ctx;
272}
273
274int crypto_shash_setkey(struct crypto_shash *tfm, const u8 *key,
275 unsigned int keylen);
276int crypto_shash_digest(struct shash_desc *desc, const u8 *data,
277 unsigned int len, u8 *out);
278
279static inline void crypto_shash_export(struct shash_desc *desc, u8 *out)
280{
281 memcpy(out, shash_desc_ctx(desc), crypto_shash_descsize(desc->tfm));
282}
283
284int crypto_shash_import(struct shash_desc *desc, const u8 *in);
285
286static inline int crypto_shash_init(struct shash_desc *desc)
287{
288 return crypto_shash_alg(desc->tfm)->init(desc);
289}
290
291int crypto_shash_update(struct shash_desc *desc, const u8 *data,
292 unsigned int len);
293int crypto_shash_final(struct shash_desc *desc, u8 *out);
294int crypto_shash_finup(struct shash_desc *desc, const u8 *data,
295 unsigned int len, u8 *out);
296
172#endif /* _CRYPTO_HASH_H */ 297#endif /* _CRYPTO_HASH_H */
diff --git a/include/crypto/internal/hash.h b/include/crypto/internal/hash.h
index 917ae57bad4..82b70564bca 100644
--- a/include/crypto/internal/hash.h
+++ b/include/crypto/internal/hash.h
@@ -39,6 +39,12 @@ extern const struct crypto_type crypto_ahash_type;
39int crypto_hash_walk_done(struct crypto_hash_walk *walk, int err); 39int crypto_hash_walk_done(struct crypto_hash_walk *walk, int err);
40int crypto_hash_walk_first(struct ahash_request *req, 40int crypto_hash_walk_first(struct ahash_request *req,
41 struct crypto_hash_walk *walk); 41 struct crypto_hash_walk *walk);
42int crypto_hash_walk_first_compat(struct hash_desc *hdesc,
43 struct crypto_hash_walk *walk,
44 struct scatterlist *sg, unsigned int len);
45
46int crypto_register_shash(struct shash_alg *alg);
47int crypto_unregister_shash(struct shash_alg *alg);
42 48
43static inline void *crypto_ahash_ctx(struct crypto_ahash *tfm) 49static inline void *crypto_ahash_ctx(struct crypto_ahash *tfm)
44{ 50{
@@ -63,16 +69,16 @@ static inline struct ahash_request *ahash_dequeue_request(
63 return ahash_request_cast(crypto_dequeue_request(queue)); 69 return ahash_request_cast(crypto_dequeue_request(queue));
64} 70}
65 71
66static inline void *ahash_request_ctx(struct ahash_request *req)
67{
68 return req->__ctx;
69}
70
71static inline int ahash_tfm_in_queue(struct crypto_queue *queue, 72static inline int ahash_tfm_in_queue(struct crypto_queue *queue,
72 struct crypto_ahash *tfm) 73 struct crypto_ahash *tfm)
73{ 74{
74 return crypto_tfm_in_queue(queue, crypto_ahash_tfm(tfm)); 75 return crypto_tfm_in_queue(queue, crypto_ahash_tfm(tfm));
75} 76}
76 77
78static inline void *crypto_shash_ctx(struct crypto_shash *tfm)
79{
80 return crypto_tfm_ctx(&tfm->base);
81}
82
77#endif /* _CRYPTO_INTERNAL_HASH_H */ 83#endif /* _CRYPTO_INTERNAL_HASH_H */
78 84
diff --git a/include/drm/Kbuild b/include/drm/Kbuild
index 82b6983b7fb..b940fdfa3b2 100644
--- a/include/drm/Kbuild
+++ b/include/drm/Kbuild
@@ -1,4 +1,4 @@
1unifdef-y += drm.h drm_sarea.h 1unifdef-y += drm.h drm_sarea.h drm_mode.h
2unifdef-y += i810_drm.h 2unifdef-y += i810_drm.h
3unifdef-y += i830_drm.h 3unifdef-y += i830_drm.h
4unifdef-y += i915_drm.h 4unifdef-y += i915_drm.h
diff --git a/include/drm/drm.h b/include/drm/drm.h
index f46ba4b57da..32e5096554e 100644
--- a/include/drm/drm.h
+++ b/include/drm/drm.h
@@ -173,6 +173,7 @@ enum drm_map_type {
173 _DRM_AGP = 3, /**< AGP/GART */ 173 _DRM_AGP = 3, /**< AGP/GART */
174 _DRM_SCATTER_GATHER = 4, /**< Scatter/gather memory for PCI DMA */ 174 _DRM_SCATTER_GATHER = 4, /**< Scatter/gather memory for PCI DMA */
175 _DRM_CONSISTENT = 5, /**< Consistent memory for PCI DMA */ 175 _DRM_CONSISTENT = 5, /**< Consistent memory for PCI DMA */
176 _DRM_GEM = 6, /**< GEM object */
176}; 177};
177 178
178/** 179/**
@@ -598,6 +599,8 @@ struct drm_gem_open {
598 uint64_t size; 599 uint64_t size;
599}; 600};
600 601
602#include "drm_mode.h"
603
601#define DRM_IOCTL_BASE 'd' 604#define DRM_IOCTL_BASE 'd'
602#define DRM_IO(nr) _IO(DRM_IOCTL_BASE,nr) 605#define DRM_IO(nr) _IO(DRM_IOCTL_BASE,nr)
603#define DRM_IOR(nr,type) _IOR(DRM_IOCTL_BASE,nr,type) 606#define DRM_IOR(nr,type) _IOR(DRM_IOCTL_BASE,nr,type)
@@ -634,6 +637,9 @@ struct drm_gem_open {
634#define DRM_IOCTL_SET_SAREA_CTX DRM_IOW( 0x1c, struct drm_ctx_priv_map) 637#define DRM_IOCTL_SET_SAREA_CTX DRM_IOW( 0x1c, struct drm_ctx_priv_map)
635#define DRM_IOCTL_GET_SAREA_CTX DRM_IOWR(0x1d, struct drm_ctx_priv_map) 638#define DRM_IOCTL_GET_SAREA_CTX DRM_IOWR(0x1d, struct drm_ctx_priv_map)
636 639
640#define DRM_IOCTL_SET_MASTER DRM_IO(0x1e)
641#define DRM_IOCTL_DROP_MASTER DRM_IO(0x1f)
642
637#define DRM_IOCTL_ADD_CTX DRM_IOWR(0x20, struct drm_ctx) 643#define DRM_IOCTL_ADD_CTX DRM_IOWR(0x20, struct drm_ctx)
638#define DRM_IOCTL_RM_CTX DRM_IOWR(0x21, struct drm_ctx) 644#define DRM_IOCTL_RM_CTX DRM_IOWR(0x21, struct drm_ctx)
639#define DRM_IOCTL_MOD_CTX DRM_IOW( 0x22, struct drm_ctx) 645#define DRM_IOCTL_MOD_CTX DRM_IOW( 0x22, struct drm_ctx)
@@ -664,6 +670,24 @@ struct drm_gem_open {
664 670
665#define DRM_IOCTL_UPDATE_DRAW DRM_IOW(0x3f, struct drm_update_draw) 671#define DRM_IOCTL_UPDATE_DRAW DRM_IOW(0x3f, struct drm_update_draw)
666 672
673#define DRM_IOCTL_MODE_GETRESOURCES DRM_IOWR(0xA0, struct drm_mode_card_res)
674#define DRM_IOCTL_MODE_GETCRTC DRM_IOWR(0xA1, struct drm_mode_crtc)
675#define DRM_IOCTL_MODE_SETCRTC DRM_IOWR(0xA2, struct drm_mode_crtc)
676#define DRM_IOCTL_MODE_CURSOR DRM_IOWR(0xA3, struct drm_mode_cursor)
677#define DRM_IOCTL_MODE_GETGAMMA DRM_IOWR(0xA4, struct drm_mode_crtc_lut)
678#define DRM_IOCTL_MODE_SETGAMMA DRM_IOWR(0xA5, struct drm_mode_crtc_lut)
679#define DRM_IOCTL_MODE_GETENCODER DRM_IOWR(0xA6, struct drm_mode_get_encoder)
680#define DRM_IOCTL_MODE_GETCONNECTOR DRM_IOWR(0xA7, struct drm_mode_get_connector)
681#define DRM_IOCTL_MODE_ATTACHMODE DRM_IOWR(0xA8, struct drm_mode_mode_cmd)
682#define DRM_IOCTL_MODE_DETACHMODE DRM_IOWR(0xA9, struct drm_mode_mode_cmd)
683
684#define DRM_IOCTL_MODE_GETPROPERTY DRM_IOWR(0xAA, struct drm_mode_get_property)
685#define DRM_IOCTL_MODE_SETPROPERTY DRM_IOWR(0xAB, struct drm_mode_connector_set_property)
686#define DRM_IOCTL_MODE_GETPROPBLOB DRM_IOWR(0xAC, struct drm_mode_get_blob)
687#define DRM_IOCTL_MODE_GETFB DRM_IOWR(0xAD, struct drm_mode_fb_cmd)
688#define DRM_IOCTL_MODE_ADDFB DRM_IOWR(0xAE, struct drm_mode_fb_cmd)
689#define DRM_IOCTL_MODE_RMFB DRM_IOWR(0xAF, unsigned int)
690
667/** 691/**
668 * Device specific ioctls should only be in their respective headers 692 * Device specific ioctls should only be in their respective headers
669 * The device specific ioctl range is from 0x40 to 0x99. 693 * The device specific ioctl range is from 0x40 to 0x99.
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index d5e8e5c8954..afb7858c068 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -105,6 +105,7 @@ struct drm_device;
105#define DRIVER_FB_DMA 0x400 105#define DRIVER_FB_DMA 0x400
106#define DRIVER_IRQ_VBL2 0x800 106#define DRIVER_IRQ_VBL2 0x800
107#define DRIVER_GEM 0x1000 107#define DRIVER_GEM 0x1000
108#define DRIVER_MODESET 0x2000
108 109
109/***********************************************************************/ 110/***********************************************************************/
110/** \name Begin the DRM... */ 111/** \name Begin the DRM... */
@@ -238,11 +239,11 @@ struct drm_device;
238 */ 239 */
239#define LOCK_TEST_WITH_RETURN( dev, file_priv ) \ 240#define LOCK_TEST_WITH_RETURN( dev, file_priv ) \
240do { \ 241do { \
241 if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || \ 242 if (!_DRM_LOCK_IS_HELD(file_priv->master->lock.hw_lock->lock) || \
242 dev->lock.file_priv != file_priv ) { \ 243 file_priv->master->lock.file_priv != file_priv) { \
243 DRM_ERROR( "%s called without lock held, held %d owner %p %p\n",\ 244 DRM_ERROR( "%s called without lock held, held %d owner %p %p\n",\
244 __func__, _DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ),\ 245 __func__, _DRM_LOCK_IS_HELD(file_priv->master->lock.hw_lock->lock),\
245 dev->lock.file_priv, file_priv ); \ 246 file_priv->master->lock.file_priv, file_priv); \
246 return -EINVAL; \ 247 return -EINVAL; \
247 } \ 248 } \
248} while (0) 249} while (0)
@@ -276,6 +277,7 @@ typedef int drm_ioctl_compat_t(struct file *filp, unsigned int cmd,
276#define DRM_AUTH 0x1 277#define DRM_AUTH 0x1
277#define DRM_MASTER 0x2 278#define DRM_MASTER 0x2
278#define DRM_ROOT_ONLY 0x4 279#define DRM_ROOT_ONLY 0x4
280#define DRM_CONTROL_ALLOW 0x8
279 281
280struct drm_ioctl_desc { 282struct drm_ioctl_desc {
281 unsigned int cmd; 283 unsigned int cmd;
@@ -379,21 +381,26 @@ struct drm_buf_entry {
379/** File private data */ 381/** File private data */
380struct drm_file { 382struct drm_file {
381 int authenticated; 383 int authenticated;
382 int master;
383 pid_t pid; 384 pid_t pid;
384 uid_t uid; 385 uid_t uid;
385 drm_magic_t magic; 386 drm_magic_t magic;
386 unsigned long ioctl_count; 387 unsigned long ioctl_count;
387 struct list_head lhead; 388 struct list_head lhead;
388 struct drm_minor *minor; 389 struct drm_minor *minor;
389 int remove_auth_on_close;
390 unsigned long lock_count; 390 unsigned long lock_count;
391
391 /** Mapping of mm object handles to object pointers. */ 392 /** Mapping of mm object handles to object pointers. */
392 struct idr object_idr; 393 struct idr object_idr;
393 /** Lock for synchronization of access to object_idr. */ 394 /** Lock for synchronization of access to object_idr. */
394 spinlock_t table_lock; 395 spinlock_t table_lock;
396
395 struct file *filp; 397 struct file *filp;
396 void *driver_priv; 398 void *driver_priv;
399
400 int is_master; /* this file private is a master for a minor */
401 struct drm_master *master; /* master this node is currently associated with
402 N.B. not always minor->master */
403 struct list_head fbs;
397}; 404};
398 405
399/** Wait queue */ 406/** Wait queue */
@@ -523,6 +530,8 @@ struct drm_map_list {
523 struct drm_hash_item hash; 530 struct drm_hash_item hash;
524 struct drm_map *map; /**< mapping */ 531 struct drm_map *map; /**< mapping */
525 uint64_t user_token; 532 uint64_t user_token;
533 struct drm_master *master;
534 struct drm_mm_node *file_offset_node; /**< fake offset */
526}; 535};
527 536
528typedef struct drm_map drm_local_map_t; 537typedef struct drm_map drm_local_map_t;
@@ -563,6 +572,14 @@ struct drm_ati_pcigart_info {
563}; 572};
564 573
565/** 574/**
575 * GEM specific mm private for tracking GEM objects
576 */
577struct drm_gem_mm {
578 struct drm_mm offset_manager; /**< Offset mgmt for buffer objects */
579 struct drm_open_hash offset_hash; /**< User token hash table for maps */
580};
581
582/**
566 * This structure defines the drm_mm memory object, which will be used by the 583 * This structure defines the drm_mm memory object, which will be used by the
567 * DRM for its buffer objects. 584 * DRM for its buffer objects.
568 */ 585 */
@@ -579,6 +596,9 @@ struct drm_gem_object {
579 /** File representing the shmem storage */ 596 /** File representing the shmem storage */
580 struct file *filp; 597 struct file *filp;
581 598
599 /* Mapping info for this object */
600 struct drm_map_list map_list;
601
582 /** 602 /**
583 * Size of the object, in bytes. Immutable over the object's 603 * Size of the object, in bytes. Immutable over the object's
584 * lifetime. 604 * lifetime.
@@ -612,6 +632,33 @@ struct drm_gem_object {
612 void *driver_private; 632 void *driver_private;
613}; 633};
614 634
635#include "drm_crtc.h"
636
637/* per-master structure */
638struct drm_master {
639
640 struct kref refcount; /* refcount for this master */
641
642 struct list_head head; /**< each minor contains a list of masters */
643 struct drm_minor *minor; /**< link back to minor we are a master for */
644
645 char *unique; /**< Unique identifier: e.g., busid */
646 int unique_len; /**< Length of unique field */
647 int unique_size; /**< amount allocated */
648
649 int blocked; /**< Blocked due to VC switch? */
650
651 /** \name Authentication */
652 /*@{ */
653 struct drm_open_hash magiclist;
654 struct list_head magicfree;
655 /*@} */
656
657 struct drm_lock_data lock; /**< Information on hardware lock */
658
659 void *driver_priv; /**< Private structure for driver to use */
660};
661
615/** 662/**
616 * DRM driver structure. This structure represent the common code for 663 * DRM driver structure. This structure represent the common code for
617 * a family of cards. There will one drm_device for each card present 664 * a family of cards. There will one drm_device for each card present
@@ -712,6 +759,10 @@ struct drm_driver {
712 void (*set_version) (struct drm_device *dev, 759 void (*set_version) (struct drm_device *dev,
713 struct drm_set_version *sv); 760 struct drm_set_version *sv);
714 761
762 /* Master routines */
763 int (*master_create)(struct drm_device *dev, struct drm_master *master);
764 void (*master_destroy)(struct drm_device *dev, struct drm_master *master);
765
715 int (*proc_init)(struct drm_minor *minor); 766 int (*proc_init)(struct drm_minor *minor);
716 void (*proc_cleanup)(struct drm_minor *minor); 767 void (*proc_cleanup)(struct drm_minor *minor);
717 768
@@ -724,6 +775,9 @@ struct drm_driver {
724 int (*gem_init_object) (struct drm_gem_object *obj); 775 int (*gem_init_object) (struct drm_gem_object *obj);
725 void (*gem_free_object) (struct drm_gem_object *obj); 776 void (*gem_free_object) (struct drm_gem_object *obj);
726 777
778 /* Driver private ops for this object */
779 struct vm_operations_struct *gem_vm_ops;
780
727 int major; 781 int major;
728 int minor; 782 int minor;
729 int patchlevel; 783 int patchlevel;
@@ -737,10 +791,14 @@ struct drm_driver {
737 int num_ioctls; 791 int num_ioctls;
738 struct file_operations fops; 792 struct file_operations fops;
739 struct pci_driver pci_driver; 793 struct pci_driver pci_driver;
794 /* List of devices hanging off this driver */
795 struct list_head device_list;
740}; 796};
741 797
742#define DRM_MINOR_UNASSIGNED 0 798#define DRM_MINOR_UNASSIGNED 0
743#define DRM_MINOR_LEGACY 1 799#define DRM_MINOR_LEGACY 1
800#define DRM_MINOR_CONTROL 2
801#define DRM_MINOR_RENDER 3
744 802
745/** 803/**
746 * DRM minor structure. This structure represents a drm minor number. 804 * DRM minor structure. This structure represents a drm minor number.
@@ -752,6 +810,9 @@ struct drm_minor {
752 struct device kdev; /**< Linux device */ 810 struct device kdev; /**< Linux device */
753 struct drm_device *dev; 811 struct drm_device *dev;
754 struct proc_dir_entry *dev_root; /**< proc directory entry */ 812 struct proc_dir_entry *dev_root; /**< proc directory entry */
813 struct drm_master *master; /* currently active master for this node */
814 struct list_head master_list;
815 struct drm_mode_group mode_group;
755}; 816};
756 817
757/** 818/**
@@ -759,13 +820,10 @@ struct drm_minor {
759 * may contain multiple heads. 820 * may contain multiple heads.
760 */ 821 */
761struct drm_device { 822struct drm_device {
762 char *unique; /**< Unique identifier: e.g., busid */ 823 struct list_head driver_item; /**< list of devices per driver */
763 int unique_len; /**< Length of unique field */
764 char *devname; /**< For /proc/interrupts */ 824 char *devname; /**< For /proc/interrupts */
765 int if_version; /**< Highest interface version set */ 825 int if_version; /**< Highest interface version set */
766 826
767 int blocked; /**< Blocked due to VC switch? */
768
769 /** \name Locks */ 827 /** \name Locks */
770 /*@{ */ 828 /*@{ */
771 spinlock_t count_lock; /**< For inuse, drm_device::open_count, drm_device::buf_use */ 829 spinlock_t count_lock; /**< For inuse, drm_device::open_count, drm_device::buf_use */
@@ -788,12 +846,7 @@ struct drm_device {
788 atomic_t counts[15]; 846 atomic_t counts[15];
789 /*@} */ 847 /*@} */
790 848
791 /** \name Authentication */
792 /*@{ */
793 struct list_head filelist; 849 struct list_head filelist;
794 struct drm_open_hash magiclist; /**< magic hash table */
795 struct list_head magicfree;
796 /*@} */
797 850
798 /** \name Memory management */ 851 /** \name Memory management */
799 /*@{ */ 852 /*@{ */
@@ -810,7 +863,7 @@ struct drm_device {
810 struct idr ctx_idr; 863 struct idr ctx_idr;
811 864
812 struct list_head vmalist; /**< List of vmas (for debugging) */ 865 struct list_head vmalist; /**< List of vmas (for debugging) */
813 struct drm_lock_data lock; /**< Information on hardware lock */ 866
814 /*@} */ 867 /*@} */
815 868
816 /** \name DMA queues (contexts) */ 869 /** \name DMA queues (contexts) */
@@ -858,6 +911,7 @@ struct drm_device {
858 int *vblank_enabled; /* so we don't call enable more than 911 int *vblank_enabled; /* so we don't call enable more than
859 once per disable */ 912 once per disable */
860 int *vblank_inmodeset; /* Display driver is setting mode */ 913 int *vblank_inmodeset; /* Display driver is setting mode */
914 u32 *last_vblank_wait; /* Last vblank seqno waited per CRTC */
861 struct timer_list vblank_disable_timer; 915 struct timer_list vblank_disable_timer;
862 916
863 u32 max_vblank_count; /**< size of vblank counter register */ 917 u32 max_vblank_count; /**< size of vblank counter register */
@@ -881,12 +935,15 @@ struct drm_device {
881 struct drm_sg_mem *sg; /**< Scatter gather memory */ 935 struct drm_sg_mem *sg; /**< Scatter gather memory */
882 int num_crtcs; /**< Number of CRTCs on this device */ 936 int num_crtcs; /**< Number of CRTCs on this device */
883 void *dev_private; /**< device private data */ 937 void *dev_private; /**< device private data */
938 void *mm_private;
939 struct address_space *dev_mapping;
884 struct drm_sigdata sigdata; /**< For block_all_signals */ 940 struct drm_sigdata sigdata; /**< For block_all_signals */
885 sigset_t sigmask; 941 sigset_t sigmask;
886 942
887 struct drm_driver *driver; 943 struct drm_driver *driver;
888 drm_local_map_t *agp_buffer_map; 944 drm_local_map_t *agp_buffer_map;
889 unsigned int agp_buffer_token; 945 unsigned int agp_buffer_token;
946 struct drm_minor *control; /**< Control node for card */
890 struct drm_minor *primary; /**< render type primary screen head */ 947 struct drm_minor *primary; /**< render type primary screen head */
891 948
892 /** \name Drawable information */ 949 /** \name Drawable information */
@@ -895,6 +952,8 @@ struct drm_device {
895 struct idr drw_idr; 952 struct idr drw_idr;
896 /*@} */ 953 /*@} */
897 954
955 struct drm_mode_config mode_config; /**< Current mode config */
956
898 /** \name GEM information */ 957 /** \name GEM information */
899 /*@{ */ 958 /*@{ */
900 spinlock_t object_name_lock; 959 spinlock_t object_name_lock;
@@ -997,6 +1056,8 @@ extern int drm_release(struct inode *inode, struct file *filp);
997 1056
998 /* Mapping support (drm_vm.h) */ 1057 /* Mapping support (drm_vm.h) */
999extern int drm_mmap(struct file *filp, struct vm_area_struct *vma); 1058extern int drm_mmap(struct file *filp, struct vm_area_struct *vma);
1059extern int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma);
1060extern void drm_vm_open_locked(struct vm_area_struct *vma);
1000extern unsigned long drm_core_get_map_ofs(struct drm_map * map); 1061extern unsigned long drm_core_get_map_ofs(struct drm_map * map);
1001extern unsigned long drm_core_get_reg_ofs(struct drm_device *dev); 1062extern unsigned long drm_core_get_reg_ofs(struct drm_device *dev);
1002extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait); 1063extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait);
@@ -1153,6 +1214,8 @@ extern int drm_vblank_get(struct drm_device *dev, int crtc);
1153extern void drm_vblank_put(struct drm_device *dev, int crtc); 1214extern void drm_vblank_put(struct drm_device *dev, int crtc);
1154extern void drm_vblank_cleanup(struct drm_device *dev); 1215extern void drm_vblank_cleanup(struct drm_device *dev);
1155/* Modesetting support */ 1216/* Modesetting support */
1217extern void drm_vblank_pre_modeset(struct drm_device *dev, int crtc);
1218extern void drm_vblank_post_modeset(struct drm_device *dev, int crtc);
1156extern int drm_modeset_ctl(struct drm_device *dev, void *data, 1219extern int drm_modeset_ctl(struct drm_device *dev, void *data,
1157 struct drm_file *file_priv); 1220 struct drm_file *file_priv);
1158 1221
@@ -1189,6 +1252,13 @@ extern int drm_agp_unbind_memory(DRM_AGP_MEM * handle);
1189extern void drm_agp_chipset_flush(struct drm_device *dev); 1252extern void drm_agp_chipset_flush(struct drm_device *dev);
1190 1253
1191 /* Stub support (drm_stub.h) */ 1254 /* Stub support (drm_stub.h) */
1255extern int drm_setmaster_ioctl(struct drm_device *dev, void *data,
1256 struct drm_file *file_priv);
1257extern int drm_dropmaster_ioctl(struct drm_device *dev, void *data,
1258 struct drm_file *file_priv);
1259struct drm_master *drm_master_create(struct drm_minor *minor);
1260extern struct drm_master *drm_master_get(struct drm_master *master);
1261extern void drm_master_put(struct drm_master **master);
1192extern int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent, 1262extern int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
1193 struct drm_driver *driver); 1263 struct drm_driver *driver);
1194extern int drm_put_dev(struct drm_device *dev); 1264extern int drm_put_dev(struct drm_device *dev);
@@ -1231,7 +1301,11 @@ struct drm_sysfs_class;
1231extern struct class *drm_sysfs_create(struct module *owner, char *name); 1301extern struct class *drm_sysfs_create(struct module *owner, char *name);
1232extern void drm_sysfs_destroy(void); 1302extern void drm_sysfs_destroy(void);
1233extern int drm_sysfs_device_add(struct drm_minor *minor); 1303extern int drm_sysfs_device_add(struct drm_minor *minor);
1304extern void drm_sysfs_hotplug_event(struct drm_device *dev);
1234extern void drm_sysfs_device_remove(struct drm_minor *minor); 1305extern void drm_sysfs_device_remove(struct drm_minor *minor);
1306extern char *drm_get_connector_status_name(enum drm_connector_status status);
1307extern int drm_sysfs_connector_add(struct drm_connector *connector);
1308extern void drm_sysfs_connector_remove(struct drm_connector *connector);
1235 1309
1236/* 1310/*
1237 * Basic memory manager support (drm_mm.c) 1311 * Basic memory manager support (drm_mm.c)
@@ -1251,10 +1325,12 @@ extern int drm_mm_add_space_to_tail(struct drm_mm *mm, unsigned long size);
1251 1325
1252/* Graphics Execution Manager library functions (drm_gem.c) */ 1326/* Graphics Execution Manager library functions (drm_gem.c) */
1253int drm_gem_init(struct drm_device *dev); 1327int drm_gem_init(struct drm_device *dev);
1328void drm_gem_destroy(struct drm_device *dev);
1254void drm_gem_object_free(struct kref *kref); 1329void drm_gem_object_free(struct kref *kref);
1255struct drm_gem_object *drm_gem_object_alloc(struct drm_device *dev, 1330struct drm_gem_object *drm_gem_object_alloc(struct drm_device *dev,
1256 size_t size); 1331 size_t size);
1257void drm_gem_object_handle_free(struct kref *kref); 1332void drm_gem_object_handle_free(struct kref *kref);
1333int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma);
1258 1334
1259static inline void 1335static inline void
1260drm_gem_object_reference(struct drm_gem_object *obj) 1336drm_gem_object_reference(struct drm_gem_object *obj)
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
new file mode 100644
index 00000000000..0acb07f31fa
--- /dev/null
+++ b/include/drm/drm_crtc.h
@@ -0,0 +1,733 @@
1/*
2 * Copyright © 2006 Keith Packard
3 * Copyright © 2007-2008 Dave Airlie
4 * Copyright © 2007-2008 Intel Corporation
5 * Jesse Barnes <jesse.barnes@intel.com>
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included in
15 * all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
21 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 * OTHER DEALINGS IN THE SOFTWARE.
24 */
25#ifndef __DRM_CRTC_H__
26#define __DRM_CRTC_H__
27
28#include <linux/i2c.h>
29#include <linux/spinlock.h>
30#include <linux/types.h>
31#include <linux/idr.h>
32
33#include <linux/fb.h>
34
35struct drm_device;
36struct drm_mode_set;
37struct drm_framebuffer;
38
39
40#define DRM_MODE_OBJECT_CRTC 0xcccccccc
41#define DRM_MODE_OBJECT_CONNECTOR 0xc0c0c0c0
42#define DRM_MODE_OBJECT_ENCODER 0xe0e0e0e0
43#define DRM_MODE_OBJECT_MODE 0xdededede
44#define DRM_MODE_OBJECT_PROPERTY 0xb0b0b0b0
45#define DRM_MODE_OBJECT_FB 0xfbfbfbfb
46#define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb
47
48struct drm_mode_object {
49 uint32_t id;
50 uint32_t type;
51};
52
53/*
54 * Note on terminology: here, for brevity and convenience, we refer to connector
55 * control chips as 'CRTCs'. They can control any type of connector, VGA, LVDS,
56 * DVI, etc. And 'screen' refers to the whole of the visible display, which
57 * may span multiple monitors (and therefore multiple CRTC and connector
58 * structures).
59 */
60
61enum drm_mode_status {
62 MODE_OK = 0, /* Mode OK */
63 MODE_HSYNC, /* hsync out of range */
64 MODE_VSYNC, /* vsync out of range */
65 MODE_H_ILLEGAL, /* mode has illegal horizontal timings */
66 MODE_V_ILLEGAL, /* mode has illegal horizontal timings */
67 MODE_BAD_WIDTH, /* requires an unsupported linepitch */
68 MODE_NOMODE, /* no mode with a maching name */
69 MODE_NO_INTERLACE, /* interlaced mode not supported */
70 MODE_NO_DBLESCAN, /* doublescan mode not supported */
71 MODE_NO_VSCAN, /* multiscan mode not supported */
72 MODE_MEM, /* insufficient video memory */
73 MODE_VIRTUAL_X, /* mode width too large for specified virtual size */
74 MODE_VIRTUAL_Y, /* mode height too large for specified virtual size */
75 MODE_MEM_VIRT, /* insufficient video memory given virtual size */
76 MODE_NOCLOCK, /* no fixed clock available */
77 MODE_CLOCK_HIGH, /* clock required is too high */
78 MODE_CLOCK_LOW, /* clock required is too low */
79 MODE_CLOCK_RANGE, /* clock/mode isn't in a ClockRange */
80 MODE_BAD_HVALUE, /* horizontal timing was out of range */
81 MODE_BAD_VVALUE, /* vertical timing was out of range */
82 MODE_BAD_VSCAN, /* VScan value out of range */
83 MODE_HSYNC_NARROW, /* horizontal sync too narrow */
84 MODE_HSYNC_WIDE, /* horizontal sync too wide */
85 MODE_HBLANK_NARROW, /* horizontal blanking too narrow */
86 MODE_HBLANK_WIDE, /* horizontal blanking too wide */
87 MODE_VSYNC_NARROW, /* vertical sync too narrow */
88 MODE_VSYNC_WIDE, /* vertical sync too wide */
89 MODE_VBLANK_NARROW, /* vertical blanking too narrow */
90 MODE_VBLANK_WIDE, /* vertical blanking too wide */
91 MODE_PANEL, /* exceeds panel dimensions */
92 MODE_INTERLACE_WIDTH, /* width too large for interlaced mode */
93 MODE_ONE_WIDTH, /* only one width is supported */
94 MODE_ONE_HEIGHT, /* only one height is supported */
95 MODE_ONE_SIZE, /* only one resolution is supported */
96 MODE_NO_REDUCED, /* monitor doesn't accept reduced blanking */
97 MODE_UNVERIFIED = -3, /* mode needs to reverified */
98 MODE_BAD = -2, /* unspecified reason */
99 MODE_ERROR = -1 /* error condition */
100};
101
102#define DRM_MODE_TYPE_CLOCK_CRTC_C (DRM_MODE_TYPE_CLOCK_C | \
103 DRM_MODE_TYPE_CRTC_C)
104
105#define DRM_MODE(nm, t, c, hd, hss, hse, ht, hsk, vd, vss, vse, vt, vs, f) \
106 .name = nm, .status = 0, .type = (t), .clock = (c), \
107 .hdisplay = (hd), .hsync_start = (hss), .hsync_end = (hse), \
108 .htotal = (ht), .hskew = (hsk), .vdisplay = (vd), \
109 .vsync_start = (vss), .vsync_end = (vse), .vtotal = (vt), \
110 .vscan = (vs), .flags = (f), .vrefresh = 0
111
112#define CRTC_INTERLACE_HALVE_V 0x1 /* halve V values for interlacing */
113
114struct drm_display_mode {
115 /* Header */
116 struct list_head head;
117 struct drm_mode_object base;
118
119 char name[DRM_DISPLAY_MODE_LEN];
120
121 int connector_count;
122 enum drm_mode_status status;
123 int type;
124
125 /* Proposed mode values */
126 int clock;
127 int hdisplay;
128 int hsync_start;
129 int hsync_end;
130 int htotal;
131 int hskew;
132 int vdisplay;
133 int vsync_start;
134 int vsync_end;
135 int vtotal;
136 int vscan;
137 unsigned int flags;
138
139 /* Addressable image size (may be 0 for projectors, etc.) */
140 int width_mm;
141 int height_mm;
142
143 /* Actual mode we give to hw */
144 int clock_index;
145 int synth_clock;
146 int crtc_hdisplay;
147 int crtc_hblank_start;
148 int crtc_hblank_end;
149 int crtc_hsync_start;
150 int crtc_hsync_end;
151 int crtc_htotal;
152 int crtc_hskew;
153 int crtc_vdisplay;
154 int crtc_vblank_start;
155 int crtc_vblank_end;
156 int crtc_vsync_start;
157 int crtc_vsync_end;
158 int crtc_vtotal;
159 int crtc_hadjusted;
160 int crtc_vadjusted;
161
162 /* Driver private mode info */
163 int private_size;
164 int *private;
165 int private_flags;
166
167 int vrefresh;
168 float hsync;
169};
170
171enum drm_connector_status {
172 connector_status_connected = 1,
173 connector_status_disconnected = 2,
174 connector_status_unknown = 3,
175};
176
177enum subpixel_order {
178 SubPixelUnknown = 0,
179 SubPixelHorizontalRGB,
180 SubPixelHorizontalBGR,
181 SubPixelVerticalRGB,
182 SubPixelVerticalBGR,
183 SubPixelNone,
184};
185
186
187/*
188 * Describes a given display (e.g. CRT or flat panel) and its limitations.
189 */
190struct drm_display_info {
191 char name[DRM_DISPLAY_INFO_LEN];
192 /* Input info */
193 bool serration_vsync;
194 bool sync_on_green;
195 bool composite_sync;
196 bool separate_syncs;
197 bool blank_to_black;
198 unsigned char video_level;
199 bool digital;
200 /* Physical size */
201 unsigned int width_mm;
202 unsigned int height_mm;
203
204 /* Display parameters */
205 unsigned char gamma; /* FIXME: storage format */
206 bool gtf_supported;
207 bool standard_color;
208 enum {
209 monochrome = 0,
210 rgb,
211 other,
212 unknown,
213 } display_type;
214 bool active_off_supported;
215 bool suspend_supported;
216 bool standby_supported;
217
218 /* Color info FIXME: storage format */
219 unsigned short redx, redy;
220 unsigned short greenx, greeny;
221 unsigned short bluex, bluey;
222 unsigned short whitex, whitey;
223
224 /* Clock limits FIXME: storage format */
225 unsigned int min_vfreq, max_vfreq;
226 unsigned int min_hfreq, max_hfreq;
227 unsigned int pixel_clock;
228
229 /* White point indices FIXME: storage format */
230 unsigned int wpx1, wpy1;
231 unsigned int wpgamma1;
232 unsigned int wpx2, wpy2;
233 unsigned int wpgamma2;
234
235 enum subpixel_order subpixel_order;
236
237 char *raw_edid; /* if any */
238};
239
240struct drm_framebuffer_funcs {
241 void (*destroy)(struct drm_framebuffer *framebuffer);
242 int (*create_handle)(struct drm_framebuffer *fb,
243 struct drm_file *file_priv,
244 unsigned int *handle);
245};
246
247struct drm_framebuffer {
248 struct drm_device *dev;
249 struct list_head head;
250 struct drm_mode_object base;
251 const struct drm_framebuffer_funcs *funcs;
252 unsigned int pitch;
253 unsigned int width;
254 unsigned int height;
255 /* depth can be 15 or 16 */
256 unsigned int depth;
257 int bits_per_pixel;
258 int flags;
259 void *fbdev;
260 u32 pseudo_palette[17];
261 struct list_head filp_head;
262};
263
264struct drm_property_blob {
265 struct drm_mode_object base;
266 struct list_head head;
267 unsigned int length;
268 void *data;
269};
270
271struct drm_property_enum {
272 uint64_t value;
273 struct list_head head;
274 char name[DRM_PROP_NAME_LEN];
275};
276
277struct drm_property {
278 struct list_head head;
279 struct drm_mode_object base;
280 uint32_t flags;
281 char name[DRM_PROP_NAME_LEN];
282 uint32_t num_values;
283 uint64_t *values;
284
285 struct list_head enum_blob_list;
286};
287
288struct drm_crtc;
289struct drm_connector;
290struct drm_encoder;
291
292/**
293 * drm_crtc_funcs - control CRTCs for a given device
294 * @dpms: control display power levels
295 * @save: save CRTC state
296 * @resore: restore CRTC state
297 * @lock: lock the CRTC
298 * @unlock: unlock the CRTC
299 * @shadow_allocate: allocate shadow pixmap
300 * @shadow_create: create shadow pixmap for rotation support
301 * @shadow_destroy: free shadow pixmap
302 * @mode_fixup: fixup proposed mode
303 * @mode_set: set the desired mode on the CRTC
304 * @gamma_set: specify color ramp for CRTC
305 * @destroy: deinit and free object.
306 *
307 * The drm_crtc_funcs structure is the central CRTC management structure
308 * in the DRM. Each CRTC controls one or more connectors (note that the name
309 * CRTC is simply historical, a CRTC may control LVDS, VGA, DVI, TV out, etc.
310 * connectors, not just CRTs).
311 *
312 * Each driver is responsible for filling out this structure at startup time,
313 * in addition to providing other modesetting features, like i2c and DDC
314 * bus accessors.
315 */
316struct drm_crtc_funcs {
317 /* Save CRTC state */
318 void (*save)(struct drm_crtc *crtc); /* suspend? */
319 /* Restore CRTC state */
320 void (*restore)(struct drm_crtc *crtc); /* resume? */
321
322 /* cursor controls */
323 int (*cursor_set)(struct drm_crtc *crtc, struct drm_file *file_priv,
324 uint32_t handle, uint32_t width, uint32_t height);
325 int (*cursor_move)(struct drm_crtc *crtc, int x, int y);
326
327 /* Set gamma on the CRTC */
328 void (*gamma_set)(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b,
329 uint32_t size);
330 /* Object destroy routine */
331 void (*destroy)(struct drm_crtc *crtc);
332
333 int (*set_config)(struct drm_mode_set *set);
334};
335
336/**
337 * drm_crtc - central CRTC control structure
338 * @enabled: is this CRTC enabled?
339 * @x: x position on screen
340 * @y: y position on screen
341 * @desired_mode: new desired mode
342 * @desired_x: desired x for desired_mode
343 * @desired_y: desired y for desired_mode
344 * @funcs: CRTC control functions
345 *
346 * Each CRTC may have one or more connectors associated with it. This structure
347 * allows the CRTC to be controlled.
348 */
349struct drm_crtc {
350 struct drm_device *dev;
351 struct list_head head;
352
353 struct drm_mode_object base;
354
355 /* framebuffer the connector is currently bound to */
356 struct drm_framebuffer *fb;
357
358 bool enabled;
359
360 struct drm_display_mode mode;
361
362 int x, y;
363 struct drm_display_mode *desired_mode;
364 int desired_x, desired_y;
365 const struct drm_crtc_funcs *funcs;
366
367 /* CRTC gamma size for reporting to userspace */
368 uint32_t gamma_size;
369 uint16_t *gamma_store;
370
371 /* if you are using the helper */
372 void *helper_private;
373};
374
375
376/**
377 * drm_connector_funcs - control connectors on a given device
378 * @dpms: set power state (see drm_crtc_funcs above)
379 * @save: save connector state
380 * @restore: restore connector state
381 * @mode_valid: is this mode valid on the given connector?
382 * @mode_fixup: try to fixup proposed mode for this connector
383 * @mode_set: set this mode
384 * @detect: is this connector active?
385 * @get_modes: get mode list for this connector
386 * @set_property: property for this connector may need update
387 * @destroy: make object go away
388 *
389 * Each CRTC may have one or more connectors attached to it. The functions
390 * below allow the core DRM code to control connectors, enumerate available modes,
391 * etc.
392 */
393struct drm_connector_funcs {
394 void (*dpms)(struct drm_connector *connector, int mode);
395 void (*save)(struct drm_connector *connector);
396 void (*restore)(struct drm_connector *connector);
397 enum drm_connector_status (*detect)(struct drm_connector *connector);
398 void (*fill_modes)(struct drm_connector *connector, uint32_t max_width, uint32_t max_height);
399 int (*set_property)(struct drm_connector *connector, struct drm_property *property,
400 uint64_t val);
401 void (*destroy)(struct drm_connector *connector);
402};
403
404struct drm_encoder_funcs {
405 void (*destroy)(struct drm_encoder *encoder);
406};
407
408#define DRM_CONNECTOR_MAX_UMODES 16
409#define DRM_CONNECTOR_MAX_PROPERTY 16
410#define DRM_CONNECTOR_LEN 32
411#define DRM_CONNECTOR_MAX_ENCODER 2
412
413/**
414 * drm_encoder - central DRM encoder structure
415 */
416struct drm_encoder {
417 struct drm_device *dev;
418 struct list_head head;
419
420 struct drm_mode_object base;
421 int encoder_type;
422 uint32_t possible_crtcs;
423 uint32_t possible_clones;
424
425 struct drm_crtc *crtc;
426 const struct drm_encoder_funcs *funcs;
427 void *helper_private;
428};
429
430/**
431 * drm_connector - central DRM connector control structure
432 * @crtc: CRTC this connector is currently connected to, NULL if none
433 * @interlace_allowed: can this connector handle interlaced modes?
434 * @doublescan_allowed: can this connector handle doublescan?
435 * @available_modes: modes available on this connector (from get_modes() + user)
436 * @initial_x: initial x position for this connector
437 * @initial_y: initial y position for this connector
438 * @status: connector connected?
439 * @funcs: connector control functions
440 *
441 * Each connector may be connected to one or more CRTCs, or may be clonable by
442 * another connector if they can share a CRTC. Each connector also has a specific
443 * position in the broader display (referred to as a 'screen' though it could
444 * span multiple monitors).
445 */
446struct drm_connector {
447 struct drm_device *dev;
448 struct device kdev;
449 struct device_attribute *attr;
450 struct list_head head;
451
452 struct drm_mode_object base;
453
454 int connector_type;
455 int connector_type_id;
456 bool interlace_allowed;
457 bool doublescan_allowed;
458 struct list_head modes; /* list of modes on this connector */
459
460 int initial_x, initial_y;
461 enum drm_connector_status status;
462
463 /* these are modes added by probing with DDC or the BIOS */
464 struct list_head probed_modes;
465
466 struct drm_display_info display_info;
467 const struct drm_connector_funcs *funcs;
468
469 struct list_head user_modes;
470 struct drm_property_blob *edid_blob_ptr;
471 u32 property_ids[DRM_CONNECTOR_MAX_PROPERTY];
472 uint64_t property_values[DRM_CONNECTOR_MAX_PROPERTY];
473
474 void *helper_private;
475
476 uint32_t encoder_ids[DRM_CONNECTOR_MAX_ENCODER];
477 uint32_t force_encoder_id;
478 struct drm_encoder *encoder; /* currently active encoder */
479};
480
481/**
482 * struct drm_mode_set
483 *
484 * Represents a single crtc the connectors that it drives with what mode
485 * and from which framebuffer it scans out from.
486 *
487 * This is used to set modes.
488 */
489struct drm_mode_set {
490 struct list_head head;
491
492 struct drm_framebuffer *fb;
493 struct drm_crtc *crtc;
494 struct drm_display_mode *mode;
495
496 uint32_t x;
497 uint32_t y;
498
499 struct drm_connector **connectors;
500 size_t num_connectors;
501};
502
503/**
504 * struct drm_mode_config_funcs - configure CRTCs for a given screen layout
505 * @resize: adjust CRTCs as necessary for the proposed layout
506 *
507 * Currently only a resize hook is available. DRM will call back into the
508 * driver with a new screen width and height. If the driver can't support
509 * the proposed size, it can return false. Otherwise it should adjust
510 * the CRTC<->connector mappings as needed and update its view of the screen.
511 */
512struct drm_mode_config_funcs {
513 struct drm_framebuffer *(*fb_create)(struct drm_device *dev, struct drm_file *file_priv, struct drm_mode_fb_cmd *mode_cmd);
514 int (*fb_changed)(struct drm_device *dev);
515};
516
517struct drm_mode_group {
518 uint32_t num_crtcs;
519 uint32_t num_encoders;
520 uint32_t num_connectors;
521
522 /* list of object IDs for this group */
523 uint32_t *id_list;
524};
525
526/**
527 * drm_mode_config - Mode configuration control structure
528 *
529 */
530struct drm_mode_config {
531 struct mutex mutex; /* protects configuration and IDR */
532 struct idr crtc_idr; /* use this idr for all IDs, fb, crtc, connector, modes - just makes life easier */
533 /* this is limited to one for now */
534 int num_fb;
535 struct list_head fb_list;
536 int num_connector;
537 struct list_head connector_list;
538 int num_encoder;
539 struct list_head encoder_list;
540
541 int num_crtc;
542 struct list_head crtc_list;
543
544 struct list_head property_list;
545
546 /* in-kernel framebuffers - hung of filp_head in drm_framebuffer */
547 struct list_head fb_kernel_list;
548
549 int min_width, min_height;
550 int max_width, max_height;
551 struct drm_mode_config_funcs *funcs;
552 unsigned long fb_base;
553
554 /* pointers to standard properties */
555 struct list_head property_blob_list;
556 struct drm_property *edid_property;
557 struct drm_property *dpms_property;
558
559 /* DVI-I properties */
560 struct drm_property *dvi_i_subconnector_property;
561 struct drm_property *dvi_i_select_subconnector_property;
562
563 /* TV properties */
564 struct drm_property *tv_subconnector_property;
565 struct drm_property *tv_select_subconnector_property;
566 struct drm_property *tv_mode_property;
567 struct drm_property *tv_left_margin_property;
568 struct drm_property *tv_right_margin_property;
569 struct drm_property *tv_top_margin_property;
570 struct drm_property *tv_bottom_margin_property;
571
572 /* Optional properties */
573 struct drm_property *scaling_mode_property;
574 struct drm_property *dithering_mode_property;
575};
576
577#define obj_to_crtc(x) container_of(x, struct drm_crtc, base)
578#define obj_to_connector(x) container_of(x, struct drm_connector, base)
579#define obj_to_encoder(x) container_of(x, struct drm_encoder, base)
580#define obj_to_mode(x) container_of(x, struct drm_display_mode, base)
581#define obj_to_fb(x) container_of(x, struct drm_framebuffer, base)
582#define obj_to_property(x) container_of(x, struct drm_property, base)
583#define obj_to_blob(x) container_of(x, struct drm_property_blob, base)
584
585
586extern void drm_crtc_init(struct drm_device *dev,
587 struct drm_crtc *crtc,
588 const struct drm_crtc_funcs *funcs);
589extern void drm_crtc_cleanup(struct drm_crtc *crtc);
590
591extern void drm_connector_init(struct drm_device *dev,
592 struct drm_connector *connector,
593 const struct drm_connector_funcs *funcs,
594 int connector_type);
595
596extern void drm_connector_cleanup(struct drm_connector *connector);
597
598extern void drm_encoder_init(struct drm_device *dev,
599 struct drm_encoder *encoder,
600 const struct drm_encoder_funcs *funcs,
601 int encoder_type);
602
603extern void drm_encoder_cleanup(struct drm_encoder *encoder);
604
605extern char *drm_get_connector_name(struct drm_connector *connector);
606extern char *drm_get_dpms_name(int val);
607extern char *drm_get_dvi_i_subconnector_name(int val);
608extern char *drm_get_dvi_i_select_name(int val);
609extern char *drm_get_tv_subconnector_name(int val);
610extern char *drm_get_tv_select_name(int val);
611extern void drm_fb_release(struct file *filp);
612extern int drm_mode_group_init_legacy_group(struct drm_device *dev, struct drm_mode_group *group);
613extern struct edid *drm_get_edid(struct drm_connector *connector,
614 struct i2c_adapter *adapter);
615extern unsigned char *drm_do_probe_ddc_edid(struct i2c_adapter *adapter);
616extern int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid);
617extern void drm_mode_probed_add(struct drm_connector *connector, struct drm_display_mode *mode);
618extern void drm_mode_remove(struct drm_connector *connector, struct drm_display_mode *mode);
619extern struct drm_display_mode *drm_mode_duplicate(struct drm_device *dev,
620 struct drm_display_mode *mode);
621extern void drm_mode_debug_printmodeline(struct drm_display_mode *mode);
622extern void drm_mode_config_init(struct drm_device *dev);
623extern void drm_mode_config_cleanup(struct drm_device *dev);
624extern void drm_mode_set_name(struct drm_display_mode *mode);
625extern bool drm_mode_equal(struct drm_display_mode *mode1, struct drm_display_mode *mode2);
626extern int drm_mode_width(struct drm_display_mode *mode);
627extern int drm_mode_height(struct drm_display_mode *mode);
628
629/* for us by fb module */
630extern int drm_mode_attachmode_crtc(struct drm_device *dev,
631 struct drm_crtc *crtc,
632 struct drm_display_mode *mode);
633extern int drm_mode_detachmode_crtc(struct drm_device *dev, struct drm_display_mode *mode);
634
635extern struct drm_display_mode *drm_mode_create(struct drm_device *dev);
636extern void drm_mode_destroy(struct drm_device *dev, struct drm_display_mode *mode);
637extern void drm_mode_list_concat(struct list_head *head,
638 struct list_head *new);
639extern void drm_mode_validate_size(struct drm_device *dev,
640 struct list_head *mode_list,
641 int maxX, int maxY, int maxPitch);
642extern void drm_mode_prune_invalid(struct drm_device *dev,
643 struct list_head *mode_list, bool verbose);
644extern void drm_mode_sort(struct list_head *mode_list);
645extern int drm_mode_vrefresh(struct drm_display_mode *mode);
646extern void drm_mode_set_crtcinfo(struct drm_display_mode *p,
647 int adjust_flags);
648extern void drm_mode_connector_list_update(struct drm_connector *connector);
649extern int drm_mode_connector_update_edid_property(struct drm_connector *connector,
650 struct edid *edid);
651extern int drm_connector_property_set_value(struct drm_connector *connector,
652 struct drm_property *property,
653 uint64_t value);
654extern int drm_connector_property_get_value(struct drm_connector *connector,
655 struct drm_property *property,
656 uint64_t *value);
657extern struct drm_display_mode *drm_crtc_mode_create(struct drm_device *dev);
658extern void drm_framebuffer_set_object(struct drm_device *dev,
659 unsigned long handle);
660extern int drm_framebuffer_init(struct drm_device *dev,
661 struct drm_framebuffer *fb,
662 const struct drm_framebuffer_funcs *funcs);
663extern void drm_framebuffer_cleanup(struct drm_framebuffer *fb);
664extern int drmfb_probe(struct drm_device *dev, struct drm_crtc *crtc);
665extern int drmfb_remove(struct drm_device *dev, struct drm_framebuffer *fb);
666extern void drm_crtc_probe_connector_modes(struct drm_device *dev, int maxX, int maxY);
667extern bool drm_crtc_in_use(struct drm_crtc *crtc);
668
669extern int drm_connector_attach_property(struct drm_connector *connector,
670 struct drm_property *property, uint64_t init_val);
671extern struct drm_property *drm_property_create(struct drm_device *dev, int flags,
672 const char *name, int num_values);
673extern void drm_property_destroy(struct drm_device *dev, struct drm_property *property);
674extern int drm_property_add_enum(struct drm_property *property, int index,
675 uint64_t value, const char *name);
676extern int drm_mode_create_dvi_i_properties(struct drm_device *dev);
677extern int drm_mode_create_tv_properties(struct drm_device *dev, int num_formats,
678 char *formats[]);
679extern int drm_mode_create_scaling_mode_property(struct drm_device *dev);
680extern int drm_mode_create_dithering_property(struct drm_device *dev);
681extern char *drm_get_encoder_name(struct drm_encoder *encoder);
682
683extern int drm_mode_connector_attach_encoder(struct drm_connector *connector,
684 struct drm_encoder *encoder);
685extern void drm_mode_connector_detach_encoder(struct drm_connector *connector,
686 struct drm_encoder *encoder);
687extern bool drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc,
688 int gamma_size);
689extern void *drm_mode_object_find(struct drm_device *dev, uint32_t id, uint32_t type);
690/* IOCTLs */
691extern int drm_mode_getresources(struct drm_device *dev,
692 void *data, struct drm_file *file_priv);
693
694extern int drm_mode_getcrtc(struct drm_device *dev,
695 void *data, struct drm_file *file_priv);
696extern int drm_mode_getconnector(struct drm_device *dev,
697 void *data, struct drm_file *file_priv);
698extern int drm_mode_setcrtc(struct drm_device *dev,
699 void *data, struct drm_file *file_priv);
700extern int drm_mode_cursor_ioctl(struct drm_device *dev,
701 void *data, struct drm_file *file_priv);
702extern int drm_mode_addfb(struct drm_device *dev,
703 void *data, struct drm_file *file_priv);
704extern int drm_mode_rmfb(struct drm_device *dev,
705 void *data, struct drm_file *file_priv);
706extern int drm_mode_getfb(struct drm_device *dev,
707 void *data, struct drm_file *file_priv);
708extern int drm_mode_addmode_ioctl(struct drm_device *dev,
709 void *data, struct drm_file *file_priv);
710extern int drm_mode_rmmode_ioctl(struct drm_device *dev,
711 void *data, struct drm_file *file_priv);
712extern int drm_mode_attachmode_ioctl(struct drm_device *dev,
713 void *data, struct drm_file *file_priv);
714extern int drm_mode_detachmode_ioctl(struct drm_device *dev,
715 void *data, struct drm_file *file_priv);
716
717extern int drm_mode_getproperty_ioctl(struct drm_device *dev,
718 void *data, struct drm_file *file_priv);
719extern int drm_mode_getblob_ioctl(struct drm_device *dev,
720 void *data, struct drm_file *file_priv);
721extern int drm_mode_connector_property_set_ioctl(struct drm_device *dev,
722 void *data, struct drm_file *file_priv);
723extern int drm_mode_hotplug_ioctl(struct drm_device *dev,
724 void *data, struct drm_file *file_priv);
725extern int drm_mode_replacefb(struct drm_device *dev,
726 void *data, struct drm_file *file_priv);
727extern int drm_mode_getencoder(struct drm_device *dev,
728 void *data, struct drm_file *file_priv);
729extern int drm_mode_gamma_get_ioctl(struct drm_device *dev,
730 void *data, struct drm_file *file_priv);
731extern int drm_mode_gamma_set_ioctl(struct drm_device *dev,
732 void *data, struct drm_file *file_priv);
733#endif /* __DRM_CRTC_H__ */
diff --git a/include/drm/drm_crtc_helper.h b/include/drm/drm_crtc_helper.h
new file mode 100644
index 00000000000..4bc04cf460a
--- /dev/null
+++ b/include/drm/drm_crtc_helper.h
@@ -0,0 +1,124 @@
1/*
2 * Copyright © 2006 Keith Packard
3 * Copyright © 2007-2008 Dave Airlie
4 * Copyright © 2007-2008 Intel Corporation
5 * Jesse Barnes <jesse.barnes@intel.com>
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included in
15 * all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
21 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 * OTHER DEALINGS IN THE SOFTWARE.
24 */
25
26/*
27 * The DRM mode setting helper functions are common code for drivers to use if
28 * they wish. Drivers are not forced to use this code in their
29 * implementations but it would be useful if they code they do use at least
30 * provides a consistent interface and operation to userspace
31 */
32
33#ifndef __DRM_CRTC_HELPER_H__
34#define __DRM_CRTC_HELPER_H__
35
36#include <linux/i2c.h>
37#include <linux/spinlock.h>
38#include <linux/types.h>
39#include <linux/idr.h>
40
41#include <linux/fb.h>
42
43struct drm_crtc_helper_funcs {
44 /*
45 * Control power levels on the CRTC. If the mode passed in is
46 * unsupported, the provider must use the next lowest power level.
47 */
48 void (*dpms)(struct drm_crtc *crtc, int mode);
49 void (*prepare)(struct drm_crtc *crtc);
50 void (*commit)(struct drm_crtc *crtc);
51
52 /* Provider can fixup or change mode timings before modeset occurs */
53 bool (*mode_fixup)(struct drm_crtc *crtc,
54 struct drm_display_mode *mode,
55 struct drm_display_mode *adjusted_mode);
56 /* Actually set the mode */
57 void (*mode_set)(struct drm_crtc *crtc, struct drm_display_mode *mode,
58 struct drm_display_mode *adjusted_mode, int x, int y,
59 struct drm_framebuffer *old_fb);
60
61 /* Move the crtc on the current fb to the given position *optional* */
62 void (*mode_set_base)(struct drm_crtc *crtc, int x, int y,
63 struct drm_framebuffer *old_fb);
64};
65
66struct drm_encoder_helper_funcs {
67 void (*dpms)(struct drm_encoder *encoder, int mode);
68 void (*save)(struct drm_encoder *encoder);
69 void (*restore)(struct drm_encoder *encoder);
70
71 bool (*mode_fixup)(struct drm_encoder *encoder,
72 struct drm_display_mode *mode,
73 struct drm_display_mode *adjusted_mode);
74 void (*prepare)(struct drm_encoder *encoder);
75 void (*commit)(struct drm_encoder *encoder);
76 void (*mode_set)(struct drm_encoder *encoder,
77 struct drm_display_mode *mode,
78 struct drm_display_mode *adjusted_mode);
79 /* detect for DAC style encoders */
80 enum drm_connector_status (*detect)(struct drm_encoder *encoder,
81 struct drm_connector *connector);
82};
83
84struct drm_connector_helper_funcs {
85 int (*get_modes)(struct drm_connector *connector);
86 int (*mode_valid)(struct drm_connector *connector,
87 struct drm_display_mode *mode);
88 struct drm_encoder *(*best_encoder)(struct drm_connector *connector);
89};
90
91extern void drm_helper_probe_single_connector_modes(struct drm_connector *connector, uint32_t maxX, uint32_t maxY);
92extern void drm_helper_disable_unused_functions(struct drm_device *dev);
93extern int drm_helper_hotplug_stage_two(struct drm_device *dev);
94extern bool drm_helper_initial_config(struct drm_device *dev, bool can_grow);
95extern int drm_crtc_helper_set_config(struct drm_mode_set *set);
96extern bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
97 struct drm_display_mode *mode,
98 int x, int y,
99 struct drm_framebuffer *old_fb);
100extern bool drm_helper_crtc_in_use(struct drm_crtc *crtc);
101
102extern int drm_helper_mode_fill_fb_struct(struct drm_framebuffer *fb,
103 struct drm_mode_fb_cmd *mode_cmd);
104
105static inline void drm_crtc_helper_add(struct drm_crtc *crtc,
106 const struct drm_crtc_helper_funcs *funcs)
107{
108 crtc->helper_private = (void *)funcs;
109}
110
111static inline void drm_encoder_helper_add(struct drm_encoder *encoder,
112 const struct drm_encoder_helper_funcs *funcs)
113{
114 encoder->helper_private = (void *)funcs;
115}
116
117static inline void drm_connector_helper_add(struct drm_connector *connector,
118 const struct drm_connector_helper_funcs *funcs)
119{
120 connector->helper_private = (void *)funcs;
121}
122
123extern int drm_helper_resume_force_mode(struct drm_device *dev);
124#endif
diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h
new file mode 100644
index 00000000000..c707c15f516
--- /dev/null
+++ b/include/drm/drm_edid.h
@@ -0,0 +1,202 @@
1/*
2 * Copyright © 2007-2008 Intel Corporation
3 * Jesse Barnes <jesse.barnes@intel.com>
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
19 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21 * OTHER DEALINGS IN THE SOFTWARE.
22 */
23#ifndef __DRM_EDID_H__
24#define __DRM_EDID_H__
25
26#include <linux/types.h>
27
28#define EDID_LENGTH 128
29#define DDC_ADDR 0x50
30
31#ifdef BIG_ENDIAN
32#error "EDID structure is little endian, need big endian versions"
33#else
34
35struct est_timings {
36 u8 t1;
37 u8 t2;
38 u8 mfg_rsvd;
39} __attribute__((packed));
40
41struct std_timing {
42 u8 hsize; /* need to multiply by 8 then add 248 */
43 u8 vfreq:6; /* need to add 60 */
44 u8 aspect_ratio:2; /* 00=16:10, 01=4:3, 10=5:4, 11=16:9 */
45} __attribute__((packed));
46
47/* If detailed data is pixel timing */
48struct detailed_pixel_timing {
49 u8 hactive_lo;
50 u8 hblank_lo;
51 u8 hblank_hi:4;
52 u8 hactive_hi:4;
53 u8 vactive_lo;
54 u8 vblank_lo;
55 u8 vblank_hi:4;
56 u8 vactive_hi:4;
57 u8 hsync_offset_lo;
58 u8 hsync_pulse_width_lo;
59 u8 vsync_pulse_width_lo:4;
60 u8 vsync_offset_lo:4;
61 u8 hsync_pulse_width_hi:2;
62 u8 hsync_offset_hi:2;
63 u8 vsync_pulse_width_hi:2;
64 u8 vsync_offset_hi:2;
65 u8 width_mm_lo;
66 u8 height_mm_lo;
67 u8 height_mm_hi:4;
68 u8 width_mm_hi:4;
69 u8 hborder;
70 u8 vborder;
71 u8 unknown0:1;
72 u8 vsync_positive:1;
73 u8 hsync_positive:1;
74 u8 separate_sync:2;
75 u8 stereo:1;
76 u8 unknown6:1;
77 u8 interlaced:1;
78} __attribute__((packed));
79
80/* If it's not pixel timing, it'll be one of the below */
81struct detailed_data_string {
82 u8 str[13];
83} __attribute__((packed));
84
85struct detailed_data_monitor_range {
86 u8 min_vfreq;
87 u8 max_vfreq;
88 u8 min_hfreq_khz;
89 u8 max_hfreq_khz;
90 u8 pixel_clock_mhz; /* need to multiply by 10 */
91 u16 sec_gtf_toggle; /* A000=use above, 20=use below */ /* FIXME: byte order */
92 u8 hfreq_start_khz; /* need to multiply by 2 */
93 u8 c; /* need to divide by 2 */
94 u16 m; /* FIXME: byte order */
95 u8 k;
96 u8 j; /* need to divide by 2 */
97} __attribute__((packed));
98
99struct detailed_data_wpindex {
100 u8 white_y_lo:2;
101 u8 white_x_lo:2;
102 u8 pad:4;
103 u8 white_x_hi;
104 u8 white_y_hi;
105 u8 gamma; /* need to divide by 100 then add 1 */
106} __attribute__((packed));
107
108struct detailed_data_color_point {
109 u8 windex1;
110 u8 wpindex1[3];
111 u8 windex2;
112 u8 wpindex2[3];
113} __attribute__((packed));
114
115struct detailed_non_pixel {
116 u8 pad1;
117 u8 type; /* ff=serial, fe=string, fd=monitor range, fc=monitor name
118 fb=color point data, fa=standard timing data,
119 f9=undefined, f8=mfg. reserved */
120 u8 pad2;
121 union {
122 struct detailed_data_string str;
123 struct detailed_data_monitor_range range;
124 struct detailed_data_wpindex color;
125 struct std_timing timings[5];
126 } data;
127} __attribute__((packed));
128
129#define EDID_DETAIL_STD_MODES 0xfa
130#define EDID_DETAIL_MONITOR_CPDATA 0xfb
131#define EDID_DETAIL_MONITOR_NAME 0xfc
132#define EDID_DETAIL_MONITOR_RANGE 0xfd
133#define EDID_DETAIL_MONITOR_STRING 0xfe
134#define EDID_DETAIL_MONITOR_SERIAL 0xff
135
136struct detailed_timing {
137 u16 pixel_clock; /* need to multiply by 10 KHz */ /* FIXME: byte order */
138 union {
139 struct detailed_pixel_timing pixel_data;
140 struct detailed_non_pixel other_data;
141 } data;
142} __attribute__((packed));
143
144struct edid {
145 u8 header[8];
146 /* Vendor & product info */
147 u8 mfg_id[2];
148 u8 prod_code[2];
149 u32 serial; /* FIXME: byte order */
150 u8 mfg_week;
151 u8 mfg_year;
152 /* EDID version */
153 u8 version;
154 u8 revision;
155 /* Display info: */
156 /* input definition */
157 u8 serration_vsync:1;
158 u8 sync_on_green:1;
159 u8 composite_sync:1;
160 u8 separate_syncs:1;
161 u8 blank_to_black:1;
162 u8 video_level:2;
163 u8 digital:1; /* bits below must be zero if set */
164 u8 width_cm;
165 u8 height_cm;
166 u8 gamma;
167 /* feature support */
168 u8 default_gtf:1;
169 u8 preferred_timing:1;
170 u8 standard_color:1;
171 u8 display_type:2; /* 00=mono, 01=rgb, 10=non-rgb, 11=unknown */
172 u8 pm_active_off:1;
173 u8 pm_suspend:1;
174 u8 pm_standby:1;
175 /* Color characteristics */
176 u8 red_green_lo;
177 u8 black_white_lo;
178 u8 red_x;
179 u8 red_y;
180 u8 green_x;
181 u8 green_y;
182 u8 blue_x;
183 u8 blue_y;
184 u8 white_x;
185 u8 white_y;
186 /* Est. timings and mfg rsvd timings*/
187 struct est_timings established_timings;
188 /* Standard timings 1-8*/
189 struct std_timing standard_timings[8];
190 /* Detailing timings 1-4 */
191 struct detailed_timing detailed_timings[4];
192 /* Number of 128 byte ext. blocks */
193 u8 extensions;
194 /* Checksum */
195 u8 checksum;
196} __attribute__((packed));
197
198#endif /* little endian structs */
199
200#define EDID_PRODUCT_ID(e) ((e)->prod_code[0] | ((e)->prod_code[1] << 8))
201
202#endif /* __DRM_EDID_H__ */
diff --git a/include/drm/drm_mode.h b/include/drm/drm_mode.h
new file mode 100644
index 00000000000..601d2bd839f
--- /dev/null
+++ b/include/drm/drm_mode.h
@@ -0,0 +1,271 @@
1/*
2 * Copyright (c) 2007 Dave Airlie <airlied@linux.ie>
3 * Copyright (c) 2007 Jakob Bornecrantz <wallbraker@gmail.com>
4 * Copyright (c) 2008 Red Hat Inc.
5 * Copyright (c) 2007-2008 Tungsten Graphics, Inc., Cedar Park, TX., USA
6 * Copyright (c) 2007-2008 Intel Corporation
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the "Software"),
10 * to deal in the Software without restriction, including without limitation
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12 * and/or sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following conditions:
14 *
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24 * IN THE SOFTWARE.
25 */
26
27#ifndef _DRM_MODE_H
28#define _DRM_MODE_H
29
30#if !defined(__KERNEL__) && !defined(_KERNEL)
31#include <stdint.h>
32#else
33#include <linux/kernel.h>
34#endif
35
36#define DRM_DISPLAY_INFO_LEN 32
37#define DRM_CONNECTOR_NAME_LEN 32
38#define DRM_DISPLAY_MODE_LEN 32
39#define DRM_PROP_NAME_LEN 32
40
41#define DRM_MODE_TYPE_BUILTIN (1<<0)
42#define DRM_MODE_TYPE_CLOCK_C ((1<<1) | DRM_MODE_TYPE_BUILTIN)
43#define DRM_MODE_TYPE_CRTC_C ((1<<2) | DRM_MODE_TYPE_BUILTIN)
44#define DRM_MODE_TYPE_PREFERRED (1<<3)
45#define DRM_MODE_TYPE_DEFAULT (1<<4)
46#define DRM_MODE_TYPE_USERDEF (1<<5)
47#define DRM_MODE_TYPE_DRIVER (1<<6)
48
49/* Video mode flags */
50/* bit compatible with the xorg definitions. */
51#define DRM_MODE_FLAG_PHSYNC (1<<0)
52#define DRM_MODE_FLAG_NHSYNC (1<<1)
53#define DRM_MODE_FLAG_PVSYNC (1<<2)
54#define DRM_MODE_FLAG_NVSYNC (1<<3)
55#define DRM_MODE_FLAG_INTERLACE (1<<4)
56#define DRM_MODE_FLAG_DBLSCAN (1<<5)
57#define DRM_MODE_FLAG_CSYNC (1<<6)
58#define DRM_MODE_FLAG_PCSYNC (1<<7)
59#define DRM_MODE_FLAG_NCSYNC (1<<8)
60#define DRM_MODE_FLAG_HSKEW (1<<9) /* hskew provided */
61#define DRM_MODE_FLAG_BCAST (1<<10)
62#define DRM_MODE_FLAG_PIXMUX (1<<11)
63#define DRM_MODE_FLAG_DBLCLK (1<<12)
64#define DRM_MODE_FLAG_CLKDIV2 (1<<13)
65
66/* DPMS flags */
67/* bit compatible with the xorg definitions. */
68#define DRM_MODE_DPMS_ON 0
69#define DRM_MODE_DPMS_STANDBY 1
70#define DRM_MODE_DPMS_SUSPEND 2
71#define DRM_MODE_DPMS_OFF 3
72
73/* Scaling mode options */
74#define DRM_MODE_SCALE_NON_GPU 0
75#define DRM_MODE_SCALE_FULLSCREEN 1
76#define DRM_MODE_SCALE_NO_SCALE 2
77#define DRM_MODE_SCALE_ASPECT 3
78
79/* Dithering mode options */
80#define DRM_MODE_DITHERING_OFF 0
81#define DRM_MODE_DITHERING_ON 1
82
83struct drm_mode_modeinfo {
84 uint32_t clock;
85 uint16_t hdisplay, hsync_start, hsync_end, htotal, hskew;
86 uint16_t vdisplay, vsync_start, vsync_end, vtotal, vscan;
87
88 uint32_t vrefresh; /* vertical refresh * 1000 */
89
90 uint32_t flags;
91 uint32_t type;
92 char name[DRM_DISPLAY_MODE_LEN];
93};
94
95struct drm_mode_card_res {
96 uint64_t fb_id_ptr;
97 uint64_t crtc_id_ptr;
98 uint64_t connector_id_ptr;
99 uint64_t encoder_id_ptr;
100 uint32_t count_fbs;
101 uint32_t count_crtcs;
102 uint32_t count_connectors;
103 uint32_t count_encoders;
104 uint32_t min_width, max_width;
105 uint32_t min_height, max_height;
106};
107
108struct drm_mode_crtc {
109 uint64_t set_connectors_ptr;
110 uint32_t count_connectors;
111
112 uint32_t crtc_id; /**< Id */
113 uint32_t fb_id; /**< Id of framebuffer */
114
115 uint32_t x, y; /**< Position on the frameuffer */
116
117 uint32_t gamma_size;
118 uint32_t mode_valid;
119 struct drm_mode_modeinfo mode;
120};
121
122#define DRM_MODE_ENCODER_NONE 0
123#define DRM_MODE_ENCODER_DAC 1
124#define DRM_MODE_ENCODER_TMDS 2
125#define DRM_MODE_ENCODER_LVDS 3
126#define DRM_MODE_ENCODER_TVDAC 4
127
128struct drm_mode_get_encoder {
129 uint32_t encoder_id;
130 uint32_t encoder_type;
131
132 uint32_t crtc_id; /**< Id of crtc */
133
134 uint32_t possible_crtcs;
135 uint32_t possible_clones;
136};
137
138/* This is for connectors with multiple signal types. */
139/* Try to match DRM_MODE_CONNECTOR_X as closely as possible. */
140#define DRM_MODE_SUBCONNECTOR_Automatic 0
141#define DRM_MODE_SUBCONNECTOR_Unknown 0
142#define DRM_MODE_SUBCONNECTOR_DVID 3
143#define DRM_MODE_SUBCONNECTOR_DVIA 4
144#define DRM_MODE_SUBCONNECTOR_Composite 5
145#define DRM_MODE_SUBCONNECTOR_SVIDEO 6
146#define DRM_MODE_SUBCONNECTOR_Component 8
147
148#define DRM_MODE_CONNECTOR_Unknown 0
149#define DRM_MODE_CONNECTOR_VGA 1
150#define DRM_MODE_CONNECTOR_DVII 2
151#define DRM_MODE_CONNECTOR_DVID 3
152#define DRM_MODE_CONNECTOR_DVIA 4
153#define DRM_MODE_CONNECTOR_Composite 5
154#define DRM_MODE_CONNECTOR_SVIDEO 6
155#define DRM_MODE_CONNECTOR_LVDS 7
156#define DRM_MODE_CONNECTOR_Component 8
157#define DRM_MODE_CONNECTOR_9PinDIN 9
158#define DRM_MODE_CONNECTOR_DisplayPort 10
159#define DRM_MODE_CONNECTOR_HDMIA 11
160#define DRM_MODE_CONNECTOR_HDMIB 12
161
162struct drm_mode_get_connector {
163
164 uint64_t encoders_ptr;
165 uint64_t modes_ptr;
166 uint64_t props_ptr;
167 uint64_t prop_values_ptr;
168
169 uint32_t count_modes;
170 uint32_t count_props;
171 uint32_t count_encoders;
172
173 uint32_t encoder_id; /**< Current Encoder */
174 uint32_t connector_id; /**< Id */
175 uint32_t connector_type;
176 uint32_t connector_type_id;
177
178 uint32_t connection;
179 uint32_t mm_width, mm_height; /**< HxW in millimeters */
180 uint32_t subpixel;
181};
182
183#define DRM_MODE_PROP_PENDING (1<<0)
184#define DRM_MODE_PROP_RANGE (1<<1)
185#define DRM_MODE_PROP_IMMUTABLE (1<<2)
186#define DRM_MODE_PROP_ENUM (1<<3) /* enumerated type with text strings */
187#define DRM_MODE_PROP_BLOB (1<<4)
188
189struct drm_mode_property_enum {
190 uint64_t value;
191 char name[DRM_PROP_NAME_LEN];
192};
193
194struct drm_mode_get_property {
195 uint64_t values_ptr; /* values and blob lengths */
196 uint64_t enum_blob_ptr; /* enum and blob id ptrs */
197
198 uint32_t prop_id;
199 uint32_t flags;
200 char name[DRM_PROP_NAME_LEN];
201
202 uint32_t count_values;
203 uint32_t count_enum_blobs;
204};
205
206struct drm_mode_connector_set_property {
207 uint64_t value;
208 uint32_t prop_id;
209 uint32_t connector_id;
210};
211
212struct drm_mode_get_blob {
213 uint32_t blob_id;
214 uint32_t length;
215 uint64_t data;
216};
217
218struct drm_mode_fb_cmd {
219 uint32_t fb_id;
220 uint32_t width, height;
221 uint32_t pitch;
222 uint32_t bpp;
223 uint32_t depth;
224 /* driver specific handle */
225 uint32_t handle;
226};
227
228struct drm_mode_mode_cmd {
229 uint32_t connector_id;
230 struct drm_mode_modeinfo mode;
231};
232
233#define DRM_MODE_CURSOR_BO (1<<0)
234#define DRM_MODE_CURSOR_MOVE (1<<1)
235
236/*
237 * depending on the value in flags diffrent members are used.
238 *
239 * CURSOR_BO uses
240 * crtc
241 * width
242 * height
243 * handle - if 0 turns the cursor of
244 *
245 * CURSOR_MOVE uses
246 * crtc
247 * x
248 * y
249 */
250struct drm_mode_cursor {
251 uint32_t flags;
252 uint32_t crtc_id;
253 int32_t x;
254 int32_t y;
255 uint32_t width;
256 uint32_t height;
257 /* driver specific handle */
258 uint32_t handle;
259};
260
261struct drm_mode_crtc_lut {
262 uint32_t crtc_id;
263 uint32_t gamma_size;
264
265 /* pointers to arrays */
266 uint64_t red;
267 uint64_t green;
268 uint64_t blue;
269};
270
271#endif
diff --git a/include/drm/drm_sarea.h b/include/drm/drm_sarea.h
index 480037331e4..ee5389d22c6 100644
--- a/include/drm/drm_sarea.h
+++ b/include/drm/drm_sarea.h
@@ -36,12 +36,12 @@
36 36
37/* SAREA area needs to be at least a page */ 37/* SAREA area needs to be at least a page */
38#if defined(__alpha__) 38#if defined(__alpha__)
39#define SAREA_MAX 0x2000 39#define SAREA_MAX 0x2000U
40#elif defined(__ia64__) 40#elif defined(__ia64__)
41#define SAREA_MAX 0x10000 /* 64kB */ 41#define SAREA_MAX 0x10000U /* 64kB */
42#else 42#else
43/* Intel 830M driver needs at least 8k SAREA */ 43/* Intel 830M driver needs at least 8k SAREA */
44#define SAREA_MAX 0x2000 44#define SAREA_MAX 0x2000U
45#endif 45#endif
46 46
47/** Maximum number of drawables in the SAREA */ 47/** Maximum number of drawables in the SAREA */
diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h
index 152b34da927..b3bcf72dc65 100644
--- a/include/drm/i915_drm.h
+++ b/include/drm/i915_drm.h
@@ -113,8 +113,31 @@ typedef struct _drm_i915_sarea {
113 int pipeB_y; 113 int pipeB_y;
114 int pipeB_w; 114 int pipeB_w;
115 int pipeB_h; 115 int pipeB_h;
116
117 /* fill out some space for old userspace triple buffer */
118 drm_handle_t unused_handle;
119 uint32_t unused1, unused2, unused3;
120
121 /* buffer object handles for static buffers. May change
122 * over the lifetime of the client.
123 */
124 uint32_t front_bo_handle;
125 uint32_t back_bo_handle;
126 uint32_t unused_bo_handle;
127 uint32_t depth_bo_handle;
128
116} drm_i915_sarea_t; 129} drm_i915_sarea_t;
117 130
131/* due to userspace building against these headers we need some compat here */
132#define planeA_x pipeA_x
133#define planeA_y pipeA_y
134#define planeA_w pipeA_w
135#define planeA_h pipeA_h
136#define planeB_x pipeB_x
137#define planeB_y pipeB_y
138#define planeB_w pipeB_w
139#define planeB_h pipeB_h
140
118/* Flags for perf_boxes 141/* Flags for perf_boxes
119 */ 142 */
120#define I915_BOX_RING_EMPTY 0x1 143#define I915_BOX_RING_EMPTY 0x1
@@ -160,6 +183,7 @@ typedef struct _drm_i915_sarea {
160#define DRM_I915_GEM_SET_TILING 0x21 183#define DRM_I915_GEM_SET_TILING 0x21
161#define DRM_I915_GEM_GET_TILING 0x22 184#define DRM_I915_GEM_GET_TILING 0x22
162#define DRM_I915_GEM_GET_APERTURE 0x23 185#define DRM_I915_GEM_GET_APERTURE 0x23
186#define DRM_I915_GEM_MMAP_GTT 0x24
163 187
164#define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t) 188#define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t)
165#define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH) 189#define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH)
@@ -177,6 +201,8 @@ typedef struct _drm_i915_sarea {
177#define DRM_IOCTL_I915_SET_VBLANK_PIPE DRM_IOW( DRM_COMMAND_BASE + DRM_I915_SET_VBLANK_PIPE, drm_i915_vblank_pipe_t) 201#define DRM_IOCTL_I915_SET_VBLANK_PIPE DRM_IOW( DRM_COMMAND_BASE + DRM_I915_SET_VBLANK_PIPE, drm_i915_vblank_pipe_t)
178#define DRM_IOCTL_I915_GET_VBLANK_PIPE DRM_IOR( DRM_COMMAND_BASE + DRM_I915_GET_VBLANK_PIPE, drm_i915_vblank_pipe_t) 202#define DRM_IOCTL_I915_GET_VBLANK_PIPE DRM_IOR( DRM_COMMAND_BASE + DRM_I915_GET_VBLANK_PIPE, drm_i915_vblank_pipe_t)
179#define DRM_IOCTL_I915_VBLANK_SWAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_VBLANK_SWAP, drm_i915_vblank_swap_t) 203#define DRM_IOCTL_I915_VBLANK_SWAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_VBLANK_SWAP, drm_i915_vblank_swap_t)
204#define DRM_IOCTL_I915_GEM_INIT DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_INIT, struct drm_i915_gem_init)
205#define DRM_IOCTL_I915_GEM_EXECBUFFER DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER, struct drm_i915_gem_execbuffer)
180#define DRM_IOCTL_I915_GEM_PIN DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_PIN, struct drm_i915_gem_pin) 206#define DRM_IOCTL_I915_GEM_PIN DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_PIN, struct drm_i915_gem_pin)
181#define DRM_IOCTL_I915_GEM_UNPIN DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_UNPIN, struct drm_i915_gem_unpin) 207#define DRM_IOCTL_I915_GEM_UNPIN DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_UNPIN, struct drm_i915_gem_unpin)
182#define DRM_IOCTL_I915_GEM_BUSY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_BUSY, struct drm_i915_gem_busy) 208#define DRM_IOCTL_I915_GEM_BUSY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_BUSY, struct drm_i915_gem_busy)
@@ -187,6 +213,7 @@ typedef struct _drm_i915_sarea {
187#define DRM_IOCTL_I915_GEM_PREAD DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_PREAD, struct drm_i915_gem_pread) 213#define DRM_IOCTL_I915_GEM_PREAD DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_PREAD, struct drm_i915_gem_pread)
188#define DRM_IOCTL_I915_GEM_PWRITE DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_PWRITE, struct drm_i915_gem_pwrite) 214#define DRM_IOCTL_I915_GEM_PWRITE DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_PWRITE, struct drm_i915_gem_pwrite)
189#define DRM_IOCTL_I915_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP, struct drm_i915_gem_mmap) 215#define DRM_IOCTL_I915_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP, struct drm_i915_gem_mmap)
216#define DRM_IOCTL_I915_GEM_MMAP_GTT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP_GTT, struct drm_i915_gem_mmap_gtt)
190#define DRM_IOCTL_I915_GEM_SET_DOMAIN DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_SET_DOMAIN, struct drm_i915_gem_set_domain) 217#define DRM_IOCTL_I915_GEM_SET_DOMAIN DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_SET_DOMAIN, struct drm_i915_gem_set_domain)
191#define DRM_IOCTL_I915_GEM_SW_FINISH DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_SW_FINISH, struct drm_i915_gem_sw_finish) 218#define DRM_IOCTL_I915_GEM_SW_FINISH DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_SW_FINISH, struct drm_i915_gem_sw_finish)
192#define DRM_IOCTL_I915_GEM_SET_TILING DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_SET_TILING, struct drm_i915_gem_set_tiling) 219#define DRM_IOCTL_I915_GEM_SET_TILING DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_SET_TILING, struct drm_i915_gem_set_tiling)
@@ -196,7 +223,7 @@ typedef struct _drm_i915_sarea {
196/* Allow drivers to submit batchbuffers directly to hardware, relying 223/* Allow drivers to submit batchbuffers directly to hardware, relying
197 * on the security mechanisms provided by hardware. 224 * on the security mechanisms provided by hardware.
198 */ 225 */
199typedef struct _drm_i915_batchbuffer { 226typedef struct drm_i915_batchbuffer {
200 int start; /* agp offset */ 227 int start; /* agp offset */
201 int used; /* nr bytes in use */ 228 int used; /* nr bytes in use */
202 int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */ 229 int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */
@@ -382,6 +409,18 @@ struct drm_i915_gem_mmap {
382 uint64_t addr_ptr; 409 uint64_t addr_ptr;
383}; 410};
384 411
412struct drm_i915_gem_mmap_gtt {
413 /** Handle for the object being mapped. */
414 uint32_t handle;
415 uint32_t pad;
416 /**
417 * Fake offset to use for subsequent mmap call
418 *
419 * This is a fixed-size type for 32/64 compatibility.
420 */
421 uint64_t offset;
422};
423
385struct drm_i915_gem_set_domain { 424struct drm_i915_gem_set_domain {
386 /** Handle for the object */ 425 /** Handle for the object */
387 uint32_t handle; 426 uint32_t handle;
diff --git a/include/keys/keyring-type.h b/include/keys/keyring-type.h
new file mode 100644
index 00000000000..843f872a4b6
--- /dev/null
+++ b/include/keys/keyring-type.h
@@ -0,0 +1,31 @@
1/* Keyring key type
2 *
3 * Copyright (C) 2008 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _KEYS_KEYRING_TYPE_H
13#define _KEYS_KEYRING_TYPE_H
14
15#include <linux/key.h>
16#include <linux/rcupdate.h>
17
18/*
19 * the keyring payload contains a list of the keys to which the keyring is
20 * subscribed
21 */
22struct keyring_list {
23 struct rcu_head rcu; /* RCU deletion hook */
24 unsigned short maxkeys; /* max keys this list can hold */
25 unsigned short nkeys; /* number of keys currently held */
26 unsigned short delkey; /* key to be unlinked by RCU */
27 struct key *keys[0];
28};
29
30
31#endif /* _KEYS_KEYRING_TYPE_H */
diff --git a/include/linux/aio.h b/include/linux/aio.h
index f6b8cf99b59..b16a957030f 100644
--- a/include/linux/aio.h
+++ b/include/linux/aio.h
@@ -5,6 +5,7 @@
5#include <linux/workqueue.h> 5#include <linux/workqueue.h>
6#include <linux/aio_abi.h> 6#include <linux/aio_abi.h>
7#include <linux/uio.h> 7#include <linux/uio.h>
8#include <linux/rcupdate.h>
8 9
9#include <asm/atomic.h> 10#include <asm/atomic.h>
10 11
@@ -183,7 +184,7 @@ struct kioctx {
183 184
184 /* This needs improving */ 185 /* This needs improving */
185 unsigned long user_id; 186 unsigned long user_id;
186 struct kioctx *next; 187 struct hlist_node list;
187 188
188 wait_queue_head_t wait; 189 wait_queue_head_t wait;
189 190
@@ -199,6 +200,8 @@ struct kioctx {
199 struct aio_ring_info ring_info; 200 struct aio_ring_info ring_info;
200 201
201 struct delayed_work wq; 202 struct delayed_work wq;
203
204 struct rcu_head rcu_head;
202}; 205};
203 206
204/* prototypes */ 207/* prototypes */
diff --git a/include/linux/atm.h b/include/linux/atm.h
index c791ddd9693..d3b292174ae 100644
--- a/include/linux/atm.h
+++ b/include/linux/atm.h
@@ -231,10 +231,21 @@ static __inline__ int atmpvc_addr_in_use(struct sockaddr_atmpvc addr)
231 */ 231 */
232 232
233struct atmif_sioc { 233struct atmif_sioc {
234 int number; 234 int number;
235 int length; 235 int length;
236 void __user *arg; 236 void __user *arg;
237}; 237};
238 238
239#ifdef __KERNEL__
240#ifdef CONFIG_COMPAT
241#include <linux/compat.h>
242struct compat_atmif_sioc {
243 int number;
244 int length;
245 compat_uptr_t arg;
246};
247#endif
248#endif
249
239typedef unsigned short atm_backend_t; 250typedef unsigned short atm_backend_t;
240#endif 251#endif
diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h
index a3d07c29d16..086e5c362d3 100644
--- a/include/linux/atmdev.h
+++ b/include/linux/atmdev.h
@@ -100,6 +100,10 @@ struct atm_dev_stats {
100 /* use backend to make new if */ 100 /* use backend to make new if */
101#define ATM_ADDPARTY _IOW('a', ATMIOC_SPECIAL+4,struct atm_iobuf) 101#define ATM_ADDPARTY _IOW('a', ATMIOC_SPECIAL+4,struct atm_iobuf)
102 /* add party to p2mp call */ 102 /* add party to p2mp call */
103#ifdef CONFIG_COMPAT
104/* It actually takes struct sockaddr_atmsvc, not struct atm_iobuf */
105#define COMPAT_ATM_ADDPARTY _IOW('a', ATMIOC_SPECIAL+4,struct compat_atm_iobuf)
106#endif
103#define ATM_DROPPARTY _IOW('a', ATMIOC_SPECIAL+5,int) 107#define ATM_DROPPARTY _IOW('a', ATMIOC_SPECIAL+5,int)
104 /* drop party from p2mp call */ 108 /* drop party from p2mp call */
105 109
@@ -224,6 +228,13 @@ struct atm_cirange {
224extern struct proc_dir_entry *atm_proc_root; 228extern struct proc_dir_entry *atm_proc_root;
225#endif 229#endif
226 230
231#ifdef CONFIG_COMPAT
232#include <linux/compat.h>
233struct compat_atm_iobuf {
234 int length;
235 compat_uptr_t buffer;
236};
237#endif
227 238
228struct k_atm_aal_stats { 239struct k_atm_aal_stats {
229#define __HANDLE_ITEM(i) atomic_t i 240#define __HANDLE_ITEM(i) atomic_t i
@@ -379,6 +390,10 @@ struct atmdev_ops { /* only send is required */
379 int (*open)(struct atm_vcc *vcc); 390 int (*open)(struct atm_vcc *vcc);
380 void (*close)(struct atm_vcc *vcc); 391 void (*close)(struct atm_vcc *vcc);
381 int (*ioctl)(struct atm_dev *dev,unsigned int cmd,void __user *arg); 392 int (*ioctl)(struct atm_dev *dev,unsigned int cmd,void __user *arg);
393#ifdef CONFIG_COMPAT
394 int (*compat_ioctl)(struct atm_dev *dev,unsigned int cmd,
395 void __user *arg);
396#endif
382 int (*getsockopt)(struct atm_vcc *vcc,int level,int optname, 397 int (*getsockopt)(struct atm_vcc *vcc,int level,int optname,
383 void __user *optval,int optlen); 398 void __user *optval,int optlen);
384 int (*setsockopt)(struct atm_vcc *vcc,int level,int optname, 399 int (*setsockopt)(struct atm_vcc *vcc,int level,int optname,
diff --git a/include/linux/audit.h b/include/linux/audit.h
index 8f0672d13eb..26c4f6f65a4 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -99,6 +99,8 @@
99#define AUDIT_OBJ_PID 1318 /* ptrace target */ 99#define AUDIT_OBJ_PID 1318 /* ptrace target */
100#define AUDIT_TTY 1319 /* Input on an administrative TTY */ 100#define AUDIT_TTY 1319 /* Input on an administrative TTY */
101#define AUDIT_EOE 1320 /* End of multi-record event */ 101#define AUDIT_EOE 1320 /* End of multi-record event */
102#define AUDIT_BPRM_FCAPS 1321 /* Information about fcaps increasing perms */
103#define AUDIT_CAPSET 1322 /* Record showing argument to sys_capset */
102 104
103#define AUDIT_AVC 1400 /* SE Linux avc denial or grant */ 105#define AUDIT_AVC 1400 /* SE Linux avc denial or grant */
104#define AUDIT_SELINUX_ERR 1401 /* Internal SE Linux Errors */ 106#define AUDIT_SELINUX_ERR 1401 /* Internal SE Linux Errors */
@@ -453,6 +455,10 @@ extern int __audit_mq_timedsend(mqd_t mqdes, size_t msg_len, unsigned int msg_pr
453extern int __audit_mq_timedreceive(mqd_t mqdes, size_t msg_len, unsigned int __user *u_msg_prio, const struct timespec __user *u_abs_timeout); 455extern int __audit_mq_timedreceive(mqd_t mqdes, size_t msg_len, unsigned int __user *u_msg_prio, const struct timespec __user *u_abs_timeout);
454extern int __audit_mq_notify(mqd_t mqdes, const struct sigevent __user *u_notification); 456extern int __audit_mq_notify(mqd_t mqdes, const struct sigevent __user *u_notification);
455extern int __audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat); 457extern int __audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat);
458extern int __audit_log_bprm_fcaps(struct linux_binprm *bprm,
459 const struct cred *new,
460 const struct cred *old);
461extern int __audit_log_capset(pid_t pid, const struct cred *new, const struct cred *old);
456 462
457static inline int audit_ipc_obj(struct kern_ipc_perm *ipcp) 463static inline int audit_ipc_obj(struct kern_ipc_perm *ipcp)
458{ 464{
@@ -502,6 +508,24 @@ static inline int audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat)
502 return __audit_mq_getsetattr(mqdes, mqstat); 508 return __audit_mq_getsetattr(mqdes, mqstat);
503 return 0; 509 return 0;
504} 510}
511
512static inline int audit_log_bprm_fcaps(struct linux_binprm *bprm,
513 const struct cred *new,
514 const struct cred *old)
515{
516 if (unlikely(!audit_dummy_context()))
517 return __audit_log_bprm_fcaps(bprm, new, old);
518 return 0;
519}
520
521static inline int audit_log_capset(pid_t pid, const struct cred *new,
522 const struct cred *old)
523{
524 if (unlikely(!audit_dummy_context()))
525 return __audit_log_capset(pid, new, old);
526 return 0;
527}
528
505extern int audit_n_rules; 529extern int audit_n_rules;
506extern int audit_signals; 530extern int audit_signals;
507#else 531#else
@@ -534,6 +558,8 @@ extern int audit_signals;
534#define audit_mq_timedreceive(d,l,p,t) ({ 0; }) 558#define audit_mq_timedreceive(d,l,p,t) ({ 0; })
535#define audit_mq_notify(d,n) ({ 0; }) 559#define audit_mq_notify(d,n) ({ 0; })
536#define audit_mq_getsetattr(d,s) ({ 0; }) 560#define audit_mq_getsetattr(d,s) ({ 0; })
561#define audit_log_bprm_fcaps(b, ncr, ocr) ({ 0; })
562#define audit_log_capset(pid, ncr, ocr) ({ 0; })
537#define audit_ptrace(t) ((void)0) 563#define audit_ptrace(t) ((void)0)
538#define audit_n_rules 0 564#define audit_n_rules 0
539#define audit_signals 0 565#define audit_signals 0
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index 7394b5b349f..6cbfbe29718 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -35,16 +35,20 @@ struct linux_binprm{
35 struct mm_struct *mm; 35 struct mm_struct *mm;
36 unsigned long p; /* current top of mem */ 36 unsigned long p; /* current top of mem */
37 unsigned int sh_bang:1, 37 unsigned int sh_bang:1,
38 misc_bang:1; 38 misc_bang:1,
39 cred_prepared:1,/* true if creds already prepared (multiple
40 * preps happen for interpreters) */
41 cap_effective:1;/* true if has elevated effective capabilities,
42 * false if not; except for init which inherits
43 * its parent's caps anyway */
39#ifdef __alpha__ 44#ifdef __alpha__
40 unsigned int taso:1; 45 unsigned int taso:1;
41#endif 46#endif
42 unsigned int recursion_depth; 47 unsigned int recursion_depth;
43 struct file * file; 48 struct file * file;
44 int e_uid, e_gid; 49 struct cred *cred; /* new credentials */
45 kernel_cap_t cap_post_exec_permitted; 50 int unsafe; /* how unsafe this exec is (mask of LSM_UNSAFE_*) */
46 bool cap_effective; 51 unsigned int per_clear; /* bits to clear in current->personality */
47 void *security;
48 int argc, envc; 52 int argc, envc;
49 char * filename; /* Name of binary as seen by procps */ 53 char * filename; /* Name of binary as seen by procps */
50 char * interp; /* Name of the binary really executed. Most 54 char * interp; /* Name of the binary really executed. Most
@@ -101,7 +105,7 @@ extern int setup_arg_pages(struct linux_binprm * bprm,
101 int executable_stack); 105 int executable_stack);
102extern int bprm_mm_init(struct linux_binprm *bprm); 106extern int bprm_mm_init(struct linux_binprm *bprm);
103extern int copy_strings_kernel(int argc,char ** argv,struct linux_binprm *bprm); 107extern int copy_strings_kernel(int argc,char ** argv,struct linux_binprm *bprm);
104extern void compute_creds(struct linux_binprm *binprm); 108extern void install_exec_creds(struct linux_binprm *bprm);
105extern int do_coredump(long signr, int exit_code, struct pt_regs * regs); 109extern int do_coredump(long signr, int exit_code, struct pt_regs * regs);
106extern int set_binfmt(struct linux_binfmt *new); 110extern int set_binfmt(struct linux_binfmt *new);
107extern void free_bprm(struct linux_binprm *); 111extern void free_bprm(struct linux_binprm *);
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 6a642098e5c..18462c5b8ff 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -90,10 +90,11 @@ struct bio {
90 90
91 unsigned int bi_comp_cpu; /* completion CPU */ 91 unsigned int bi_comp_cpu; /* completion CPU */
92 92
93 atomic_t bi_cnt; /* pin count */
94
93 struct bio_vec *bi_io_vec; /* the actual vec list */ 95 struct bio_vec *bi_io_vec; /* the actual vec list */
94 96
95 bio_end_io_t *bi_end_io; 97 bio_end_io_t *bi_end_io;
96 atomic_t bi_cnt; /* pin count */
97 98
98 void *bi_private; 99 void *bi_private;
99#if defined(CONFIG_BLK_DEV_INTEGRITY) 100#if defined(CONFIG_BLK_DEV_INTEGRITY)
@@ -101,6 +102,13 @@ struct bio {
101#endif 102#endif
102 103
103 bio_destructor_t *bi_destructor; /* destructor */ 104 bio_destructor_t *bi_destructor; /* destructor */
105
106 /*
107 * We can inline a number of vecs at the end of the bio, to avoid
108 * double allocations for a small number of bio_vecs. This member
109 * MUST obviously be kept at the very end of the bio.
110 */
111 struct bio_vec bi_inline_vecs[0];
104}; 112};
105 113
106/* 114/*
@@ -117,6 +125,7 @@ struct bio {
117#define BIO_CPU_AFFINE 8 /* complete bio on same CPU as submitted */ 125#define BIO_CPU_AFFINE 8 /* complete bio on same CPU as submitted */
118#define BIO_NULL_MAPPED 9 /* contains invalid user pages */ 126#define BIO_NULL_MAPPED 9 /* contains invalid user pages */
119#define BIO_FS_INTEGRITY 10 /* fs owns integrity data, not block layer */ 127#define BIO_FS_INTEGRITY 10 /* fs owns integrity data, not block layer */
128#define BIO_QUIET 11 /* Make BIO Quiet */
120#define bio_flagged(bio, flag) ((bio)->bi_flags & (1 << (flag))) 129#define bio_flagged(bio, flag) ((bio)->bi_flags & (1 << (flag)))
121 130
122/* 131/*
@@ -211,6 +220,11 @@ static inline void *bio_data(struct bio *bio)
211 return NULL; 220 return NULL;
212} 221}
213 222
223static inline int bio_has_allocated_vec(struct bio *bio)
224{
225 return bio->bi_io_vec && bio->bi_io_vec != bio->bi_inline_vecs;
226}
227
214/* 228/*
215 * will die 229 * will die
216 */ 230 */
@@ -332,7 +346,7 @@ struct bio_pair {
332extern struct bio_pair *bio_split(struct bio *bi, int first_sectors); 346extern struct bio_pair *bio_split(struct bio *bi, int first_sectors);
333extern void bio_pair_release(struct bio_pair *dbio); 347extern void bio_pair_release(struct bio_pair *dbio);
334 348
335extern struct bio_set *bioset_create(int, int); 349extern struct bio_set *bioset_create(unsigned int, unsigned int);
336extern void bioset_free(struct bio_set *); 350extern void bioset_free(struct bio_set *);
337 351
338extern struct bio *bio_alloc(gfp_t, int); 352extern struct bio *bio_alloc(gfp_t, int);
@@ -377,6 +391,7 @@ extern struct bio *bio_copy_user_iov(struct request_queue *,
377extern int bio_uncopy_user(struct bio *); 391extern int bio_uncopy_user(struct bio *);
378void zero_fill_bio(struct bio *bio); 392void zero_fill_bio(struct bio *bio);
379extern struct bio_vec *bvec_alloc_bs(gfp_t, int, unsigned long *, struct bio_set *); 393extern struct bio_vec *bvec_alloc_bs(gfp_t, int, unsigned long *, struct bio_set *);
394extern void bvec_free_bs(struct bio_set *, struct bio_vec *, unsigned int);
380extern unsigned int bvec_nr_vecs(unsigned short idx); 395extern unsigned int bvec_nr_vecs(unsigned short idx);
381 396
382/* 397/*
@@ -395,13 +410,17 @@ static inline void bio_set_completion_cpu(struct bio *bio, unsigned int cpu)
395 */ 410 */
396#define BIO_POOL_SIZE 2 411#define BIO_POOL_SIZE 2
397#define BIOVEC_NR_POOLS 6 412#define BIOVEC_NR_POOLS 6
413#define BIOVEC_MAX_IDX (BIOVEC_NR_POOLS - 1)
398 414
399struct bio_set { 415struct bio_set {
416 struct kmem_cache *bio_slab;
417 unsigned int front_pad;
418
400 mempool_t *bio_pool; 419 mempool_t *bio_pool;
401#if defined(CONFIG_BLK_DEV_INTEGRITY) 420#if defined(CONFIG_BLK_DEV_INTEGRITY)
402 mempool_t *bio_integrity_pool; 421 mempool_t *bio_integrity_pool;
403#endif 422#endif
404 mempool_t *bvec_pools[BIOVEC_NR_POOLS]; 423 mempool_t *bvec_pool;
405}; 424};
406 425
407struct biovec_slab { 426struct biovec_slab {
@@ -411,6 +430,7 @@ struct biovec_slab {
411}; 430};
412 431
413extern struct bio_set *fs_bio_set; 432extern struct bio_set *fs_bio_set;
433extern struct biovec_slab bvec_slabs[BIOVEC_NR_POOLS] __read_mostly;
414 434
415/* 435/*
416 * a small number of entries is fine, not going to be performance critical. 436 * a small number of entries is fine, not going to be performance critical.
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h
index a08c33a26ca..2878811c613 100644
--- a/include/linux/bitmap.h
+++ b/include/linux/bitmap.h
@@ -137,9 +137,12 @@ extern void bitmap_copy_le(void *dst, const unsigned long *src, int nbits);
137 (1UL<<((nbits) % BITS_PER_LONG))-1 : ~0UL \ 137 (1UL<<((nbits) % BITS_PER_LONG))-1 : ~0UL \
138) 138)
139 139
140#define small_const_nbits(nbits) \
141 (__builtin_constant_p(nbits) && (nbits) <= BITS_PER_LONG)
142
140static inline void bitmap_zero(unsigned long *dst, int nbits) 143static inline void bitmap_zero(unsigned long *dst, int nbits)
141{ 144{
142 if (nbits <= BITS_PER_LONG) 145 if (small_const_nbits(nbits))
143 *dst = 0UL; 146 *dst = 0UL;
144 else { 147 else {
145 int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long); 148 int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long);
@@ -150,7 +153,7 @@ static inline void bitmap_zero(unsigned long *dst, int nbits)
150static inline void bitmap_fill(unsigned long *dst, int nbits) 153static inline void bitmap_fill(unsigned long *dst, int nbits)
151{ 154{
152 size_t nlongs = BITS_TO_LONGS(nbits); 155 size_t nlongs = BITS_TO_LONGS(nbits);
153 if (nlongs > 1) { 156 if (!small_const_nbits(nbits)) {
154 int len = (nlongs - 1) * sizeof(unsigned long); 157 int len = (nlongs - 1) * sizeof(unsigned long);
155 memset(dst, 0xff, len); 158 memset(dst, 0xff, len);
156 } 159 }
@@ -160,7 +163,7 @@ static inline void bitmap_fill(unsigned long *dst, int nbits)
160static inline void bitmap_copy(unsigned long *dst, const unsigned long *src, 163static inline void bitmap_copy(unsigned long *dst, const unsigned long *src,
161 int nbits) 164 int nbits)
162{ 165{
163 if (nbits <= BITS_PER_LONG) 166 if (small_const_nbits(nbits))
164 *dst = *src; 167 *dst = *src;
165 else { 168 else {
166 int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long); 169 int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long);
@@ -171,7 +174,7 @@ static inline void bitmap_copy(unsigned long *dst, const unsigned long *src,
171static inline void bitmap_and(unsigned long *dst, const unsigned long *src1, 174static inline void bitmap_and(unsigned long *dst, const unsigned long *src1,
172 const unsigned long *src2, int nbits) 175 const unsigned long *src2, int nbits)
173{ 176{
174 if (nbits <= BITS_PER_LONG) 177 if (small_const_nbits(nbits))
175 *dst = *src1 & *src2; 178 *dst = *src1 & *src2;
176 else 179 else
177 __bitmap_and(dst, src1, src2, nbits); 180 __bitmap_and(dst, src1, src2, nbits);
@@ -180,7 +183,7 @@ static inline void bitmap_and(unsigned long *dst, const unsigned long *src1,
180static inline void bitmap_or(unsigned long *dst, const unsigned long *src1, 183static inline void bitmap_or(unsigned long *dst, const unsigned long *src1,
181 const unsigned long *src2, int nbits) 184 const unsigned long *src2, int nbits)
182{ 185{
183 if (nbits <= BITS_PER_LONG) 186 if (small_const_nbits(nbits))
184 *dst = *src1 | *src2; 187 *dst = *src1 | *src2;
185 else 188 else
186 __bitmap_or(dst, src1, src2, nbits); 189 __bitmap_or(dst, src1, src2, nbits);
@@ -189,7 +192,7 @@ static inline void bitmap_or(unsigned long *dst, const unsigned long *src1,
189static inline void bitmap_xor(unsigned long *dst, const unsigned long *src1, 192static inline void bitmap_xor(unsigned long *dst, const unsigned long *src1,
190 const unsigned long *src2, int nbits) 193 const unsigned long *src2, int nbits)
191{ 194{
192 if (nbits <= BITS_PER_LONG) 195 if (small_const_nbits(nbits))
193 *dst = *src1 ^ *src2; 196 *dst = *src1 ^ *src2;
194 else 197 else
195 __bitmap_xor(dst, src1, src2, nbits); 198 __bitmap_xor(dst, src1, src2, nbits);
@@ -198,7 +201,7 @@ static inline void bitmap_xor(unsigned long *dst, const unsigned long *src1,
198static inline void bitmap_andnot(unsigned long *dst, const unsigned long *src1, 201static inline void bitmap_andnot(unsigned long *dst, const unsigned long *src1,
199 const unsigned long *src2, int nbits) 202 const unsigned long *src2, int nbits)
200{ 203{
201 if (nbits <= BITS_PER_LONG) 204 if (small_const_nbits(nbits))
202 *dst = *src1 & ~(*src2); 205 *dst = *src1 & ~(*src2);
203 else 206 else
204 __bitmap_andnot(dst, src1, src2, nbits); 207 __bitmap_andnot(dst, src1, src2, nbits);
@@ -207,7 +210,7 @@ static inline void bitmap_andnot(unsigned long *dst, const unsigned long *src1,
207static inline void bitmap_complement(unsigned long *dst, const unsigned long *src, 210static inline void bitmap_complement(unsigned long *dst, const unsigned long *src,
208 int nbits) 211 int nbits)
209{ 212{
210 if (nbits <= BITS_PER_LONG) 213 if (small_const_nbits(nbits))
211 *dst = ~(*src) & BITMAP_LAST_WORD_MASK(nbits); 214 *dst = ~(*src) & BITMAP_LAST_WORD_MASK(nbits);
212 else 215 else
213 __bitmap_complement(dst, src, nbits); 216 __bitmap_complement(dst, src, nbits);
@@ -216,7 +219,7 @@ static inline void bitmap_complement(unsigned long *dst, const unsigned long *sr
216static inline int bitmap_equal(const unsigned long *src1, 219static inline int bitmap_equal(const unsigned long *src1,
217 const unsigned long *src2, int nbits) 220 const unsigned long *src2, int nbits)
218{ 221{
219 if (nbits <= BITS_PER_LONG) 222 if (small_const_nbits(nbits))
220 return ! ((*src1 ^ *src2) & BITMAP_LAST_WORD_MASK(nbits)); 223 return ! ((*src1 ^ *src2) & BITMAP_LAST_WORD_MASK(nbits));
221 else 224 else
222 return __bitmap_equal(src1, src2, nbits); 225 return __bitmap_equal(src1, src2, nbits);
@@ -225,7 +228,7 @@ static inline int bitmap_equal(const unsigned long *src1,
225static inline int bitmap_intersects(const unsigned long *src1, 228static inline int bitmap_intersects(const unsigned long *src1,
226 const unsigned long *src2, int nbits) 229 const unsigned long *src2, int nbits)
227{ 230{
228 if (nbits <= BITS_PER_LONG) 231 if (small_const_nbits(nbits))
229 return ((*src1 & *src2) & BITMAP_LAST_WORD_MASK(nbits)) != 0; 232 return ((*src1 & *src2) & BITMAP_LAST_WORD_MASK(nbits)) != 0;
230 else 233 else
231 return __bitmap_intersects(src1, src2, nbits); 234 return __bitmap_intersects(src1, src2, nbits);
@@ -234,7 +237,7 @@ static inline int bitmap_intersects(const unsigned long *src1,
234static inline int bitmap_subset(const unsigned long *src1, 237static inline int bitmap_subset(const unsigned long *src1,
235 const unsigned long *src2, int nbits) 238 const unsigned long *src2, int nbits)
236{ 239{
237 if (nbits <= BITS_PER_LONG) 240 if (small_const_nbits(nbits))
238 return ! ((*src1 & ~(*src2)) & BITMAP_LAST_WORD_MASK(nbits)); 241 return ! ((*src1 & ~(*src2)) & BITMAP_LAST_WORD_MASK(nbits));
239 else 242 else
240 return __bitmap_subset(src1, src2, nbits); 243 return __bitmap_subset(src1, src2, nbits);
@@ -242,7 +245,7 @@ static inline int bitmap_subset(const unsigned long *src1,
242 245
243static inline int bitmap_empty(const unsigned long *src, int nbits) 246static inline int bitmap_empty(const unsigned long *src, int nbits)
244{ 247{
245 if (nbits <= BITS_PER_LONG) 248 if (small_const_nbits(nbits))
246 return ! (*src & BITMAP_LAST_WORD_MASK(nbits)); 249 return ! (*src & BITMAP_LAST_WORD_MASK(nbits));
247 else 250 else
248 return __bitmap_empty(src, nbits); 251 return __bitmap_empty(src, nbits);
@@ -250,7 +253,7 @@ static inline int bitmap_empty(const unsigned long *src, int nbits)
250 253
251static inline int bitmap_full(const unsigned long *src, int nbits) 254static inline int bitmap_full(const unsigned long *src, int nbits)
252{ 255{
253 if (nbits <= BITS_PER_LONG) 256 if (small_const_nbits(nbits))
254 return ! (~(*src) & BITMAP_LAST_WORD_MASK(nbits)); 257 return ! (~(*src) & BITMAP_LAST_WORD_MASK(nbits));
255 else 258 else
256 return __bitmap_full(src, nbits); 259 return __bitmap_full(src, nbits);
@@ -258,7 +261,7 @@ static inline int bitmap_full(const unsigned long *src, int nbits)
258 261
259static inline int bitmap_weight(const unsigned long *src, int nbits) 262static inline int bitmap_weight(const unsigned long *src, int nbits)
260{ 263{
261 if (nbits <= BITS_PER_LONG) 264 if (small_const_nbits(nbits))
262 return hweight_long(*src & BITMAP_LAST_WORD_MASK(nbits)); 265 return hweight_long(*src & BITMAP_LAST_WORD_MASK(nbits));
263 return __bitmap_weight(src, nbits); 266 return __bitmap_weight(src, nbits);
264} 267}
@@ -266,7 +269,7 @@ static inline int bitmap_weight(const unsigned long *src, int nbits)
266static inline void bitmap_shift_right(unsigned long *dst, 269static inline void bitmap_shift_right(unsigned long *dst,
267 const unsigned long *src, int n, int nbits) 270 const unsigned long *src, int n, int nbits)
268{ 271{
269 if (nbits <= BITS_PER_LONG) 272 if (small_const_nbits(nbits))
270 *dst = *src >> n; 273 *dst = *src >> n;
271 else 274 else
272 __bitmap_shift_right(dst, src, n, nbits); 275 __bitmap_shift_right(dst, src, n, nbits);
@@ -275,7 +278,7 @@ static inline void bitmap_shift_right(unsigned long *dst,
275static inline void bitmap_shift_left(unsigned long *dst, 278static inline void bitmap_shift_left(unsigned long *dst,
276 const unsigned long *src, int n, int nbits) 279 const unsigned long *src, int n, int nbits)
277{ 280{
278 if (nbits <= BITS_PER_LONG) 281 if (small_const_nbits(nbits))
279 *dst = (*src << n) & BITMAP_LAST_WORD_MASK(nbits); 282 *dst = (*src << n) & BITMAP_LAST_WORD_MASK(nbits);
280 else 283 else
281 __bitmap_shift_left(dst, src, n, nbits); 284 __bitmap_shift_left(dst, src, n, nbits);
diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index 024f2b02724..61829139795 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -134,9 +134,20 @@ extern unsigned long find_first_bit(const unsigned long *addr,
134 */ 134 */
135extern unsigned long find_first_zero_bit(const unsigned long *addr, 135extern unsigned long find_first_zero_bit(const unsigned long *addr,
136 unsigned long size); 136 unsigned long size);
137
138#endif /* CONFIG_GENERIC_FIND_FIRST_BIT */ 137#endif /* CONFIG_GENERIC_FIND_FIRST_BIT */
139 138
139#ifdef CONFIG_GENERIC_FIND_LAST_BIT
140/**
141 * find_last_bit - find the last set bit in a memory region
142 * @addr: The address to start the search at
143 * @size: The maximum size to search
144 *
145 * Returns the bit number of the first set bit, or size.
146 */
147extern unsigned long find_last_bit(const unsigned long *addr,
148 unsigned long size);
149#endif /* CONFIG_GENERIC_FIND_LAST_BIT */
150
140#ifdef CONFIG_GENERIC_FIND_NEXT_BIT 151#ifdef CONFIG_GENERIC_FIND_NEXT_BIT
141 152
142/** 153/**
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 031a315c050..7035cec583b 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -26,7 +26,6 @@ struct scsi_ioctl_command;
26 26
27struct request_queue; 27struct request_queue;
28struct elevator_queue; 28struct elevator_queue;
29typedef struct elevator_queue elevator_t;
30struct request_pm_state; 29struct request_pm_state;
31struct blk_trace; 30struct blk_trace;
32struct request; 31struct request;
@@ -313,7 +312,7 @@ struct request_queue
313 */ 312 */
314 struct list_head queue_head; 313 struct list_head queue_head;
315 struct request *last_merge; 314 struct request *last_merge;
316 elevator_t *elevator; 315 struct elevator_queue *elevator;
317 316
318 /* 317 /*
319 * the queue request freelist, one for reads and one for writes 318 * the queue request freelist, one for reads and one for writes
@@ -449,6 +448,7 @@ struct request_queue
449#define QUEUE_FLAG_FAIL_IO 12 /* fake timeout */ 448#define QUEUE_FLAG_FAIL_IO 12 /* fake timeout */
450#define QUEUE_FLAG_STACKABLE 13 /* supports request stacking */ 449#define QUEUE_FLAG_STACKABLE 13 /* supports request stacking */
451#define QUEUE_FLAG_NONROT 14 /* non-rotational device (SSD) */ 450#define QUEUE_FLAG_NONROT 14 /* non-rotational device (SSD) */
451#define QUEUE_FLAG_VIRT QUEUE_FLAG_NONROT /* paravirt device */
452 452
453static inline int queue_is_locked(struct request_queue *q) 453static inline int queue_is_locked(struct request_queue *q)
454{ 454{
@@ -522,22 +522,32 @@ enum {
522 * TAG_FLUSH : ordering by tag w/ pre and post flushes 522 * TAG_FLUSH : ordering by tag w/ pre and post flushes
523 * TAG_FUA : ordering by tag w/ pre flush and FUA write 523 * TAG_FUA : ordering by tag w/ pre flush and FUA write
524 */ 524 */
525 QUEUE_ORDERED_NONE = 0x00, 525 QUEUE_ORDERED_BY_DRAIN = 0x01,
526 QUEUE_ORDERED_DRAIN = 0x01, 526 QUEUE_ORDERED_BY_TAG = 0x02,
527 QUEUE_ORDERED_TAG = 0x02, 527 QUEUE_ORDERED_DO_PREFLUSH = 0x10,
528 528 QUEUE_ORDERED_DO_BAR = 0x20,
529 QUEUE_ORDERED_PREFLUSH = 0x10, 529 QUEUE_ORDERED_DO_POSTFLUSH = 0x40,
530 QUEUE_ORDERED_POSTFLUSH = 0x20, 530 QUEUE_ORDERED_DO_FUA = 0x80,
531 QUEUE_ORDERED_FUA = 0x40, 531
532 532 QUEUE_ORDERED_NONE = 0x00,
533 QUEUE_ORDERED_DRAIN_FLUSH = QUEUE_ORDERED_DRAIN | 533
534 QUEUE_ORDERED_PREFLUSH | QUEUE_ORDERED_POSTFLUSH, 534 QUEUE_ORDERED_DRAIN = QUEUE_ORDERED_BY_DRAIN |
535 QUEUE_ORDERED_DRAIN_FUA = QUEUE_ORDERED_DRAIN | 535 QUEUE_ORDERED_DO_BAR,
536 QUEUE_ORDERED_PREFLUSH | QUEUE_ORDERED_FUA, 536 QUEUE_ORDERED_DRAIN_FLUSH = QUEUE_ORDERED_DRAIN |
537 QUEUE_ORDERED_TAG_FLUSH = QUEUE_ORDERED_TAG | 537 QUEUE_ORDERED_DO_PREFLUSH |
538 QUEUE_ORDERED_PREFLUSH | QUEUE_ORDERED_POSTFLUSH, 538 QUEUE_ORDERED_DO_POSTFLUSH,
539 QUEUE_ORDERED_TAG_FUA = QUEUE_ORDERED_TAG | 539 QUEUE_ORDERED_DRAIN_FUA = QUEUE_ORDERED_DRAIN |
540 QUEUE_ORDERED_PREFLUSH | QUEUE_ORDERED_FUA, 540 QUEUE_ORDERED_DO_PREFLUSH |
541 QUEUE_ORDERED_DO_FUA,
542
543 QUEUE_ORDERED_TAG = QUEUE_ORDERED_BY_TAG |
544 QUEUE_ORDERED_DO_BAR,
545 QUEUE_ORDERED_TAG_FLUSH = QUEUE_ORDERED_TAG |
546 QUEUE_ORDERED_DO_PREFLUSH |
547 QUEUE_ORDERED_DO_POSTFLUSH,
548 QUEUE_ORDERED_TAG_FUA = QUEUE_ORDERED_TAG |
549 QUEUE_ORDERED_DO_PREFLUSH |
550 QUEUE_ORDERED_DO_FUA,
541 551
542 /* 552 /*
543 * Ordered operation sequence 553 * Ordered operation sequence
@@ -585,7 +595,6 @@ enum {
585#define blk_fua_rq(rq) ((rq)->cmd_flags & REQ_FUA) 595#define blk_fua_rq(rq) ((rq)->cmd_flags & REQ_FUA)
586#define blk_discard_rq(rq) ((rq)->cmd_flags & REQ_DISCARD) 596#define blk_discard_rq(rq) ((rq)->cmd_flags & REQ_DISCARD)
587#define blk_bidi_rq(rq) ((rq)->next_rq != NULL) 597#define blk_bidi_rq(rq) ((rq)->next_rq != NULL)
588#define blk_empty_barrier(rq) (blk_barrier_rq(rq) && blk_fs_request(rq) && !(rq)->hard_nr_sectors)
589/* rq->queuelist of dequeued request must be list_empty() */ 598/* rq->queuelist of dequeued request must be list_empty() */
590#define blk_queued_rq(rq) (!list_empty(&(rq)->queuelist)) 599#define blk_queued_rq(rq) (!list_empty(&(rq)->queuelist))
591 600
@@ -855,10 +864,10 @@ extern void blk_queue_rq_timed_out(struct request_queue *, rq_timed_out_fn *);
855extern void blk_queue_rq_timeout(struct request_queue *, unsigned int); 864extern void blk_queue_rq_timeout(struct request_queue *, unsigned int);
856extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev); 865extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev);
857extern int blk_queue_ordered(struct request_queue *, unsigned, prepare_flush_fn *); 866extern int blk_queue_ordered(struct request_queue *, unsigned, prepare_flush_fn *);
858extern int blk_do_ordered(struct request_queue *, struct request **); 867extern bool blk_do_ordered(struct request_queue *, struct request **);
859extern unsigned blk_ordered_cur_seq(struct request_queue *); 868extern unsigned blk_ordered_cur_seq(struct request_queue *);
860extern unsigned blk_ordered_req_seq(struct request *); 869extern unsigned blk_ordered_req_seq(struct request *);
861extern void blk_ordered_complete_seq(struct request_queue *, unsigned, int); 870extern bool blk_ordered_complete_seq(struct request_queue *, unsigned, int);
862 871
863extern int blk_rq_map_sg(struct request_queue *, struct request *, struct scatterlist *); 872extern int blk_rq_map_sg(struct request_queue *, struct request *, struct scatterlist *);
864extern void blk_dump_rq_flags(struct request *, char *); 873extern void blk_dump_rq_flags(struct request *, char *);
@@ -977,7 +986,6 @@ static inline void put_dev_sector(Sector p)
977 986
978struct work_struct; 987struct work_struct;
979int kblockd_schedule_work(struct request_queue *q, struct work_struct *work); 988int kblockd_schedule_work(struct request_queue *q, struct work_struct *work);
980void kblockd_flush_work(struct work_struct *work);
981 989
982#define MODULE_ALIAS_BLOCKDEV(major,minor) \ 990#define MODULE_ALIAS_BLOCKDEV(major,minor) \
983 MODULE_ALIAS("block-major-" __stringify(major) "-" __stringify(minor)) 991 MODULE_ALIAS("block-major-" __stringify(major) "-" __stringify(minor))
diff --git a/include/linux/bottom_half.h b/include/linux/bottom_half.h
index 777dbf695d4..27b1bcffe40 100644
--- a/include/linux/bottom_half.h
+++ b/include/linux/bottom_half.h
@@ -2,7 +2,6 @@
2#define _LINUX_BH_H 2#define _LINUX_BH_H
3 3
4extern void local_bh_disable(void); 4extern void local_bh_disable(void);
5extern void __local_bh_enable(void);
6extern void _local_bh_enable(void); 5extern void _local_bh_enable(void);
7extern void local_bh_enable(void); 6extern void local_bh_enable(void);
8extern void local_bh_enable_ip(unsigned long ip); 7extern void local_bh_enable_ip(unsigned long ip);
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 3ce64b90118..8605f8a74df 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -35,6 +35,7 @@ enum bh_state_bits {
35 BH_Ordered, /* ordered write */ 35 BH_Ordered, /* ordered write */
36 BH_Eopnotsupp, /* operation not supported (barrier) */ 36 BH_Eopnotsupp, /* operation not supported (barrier) */
37 BH_Unwritten, /* Buffer is allocated on disk but not written */ 37 BH_Unwritten, /* Buffer is allocated on disk but not written */
38 BH_Quiet, /* Buffer Error Prinks to be quiet */
38 39
39 BH_PrivateStart,/* not a state bit, but the first bit available 40 BH_PrivateStart,/* not a state bit, but the first bit available
40 * for private allocation by other entities 41 * for private allocation by other entities
diff --git a/include/linux/capability.h b/include/linux/capability.h
index 9d1fe30b6f6..e22f48c2a46 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -53,6 +53,7 @@ typedef struct __user_cap_data_struct {
53#define XATTR_NAME_CAPS XATTR_SECURITY_PREFIX XATTR_CAPS_SUFFIX 53#define XATTR_NAME_CAPS XATTR_SECURITY_PREFIX XATTR_CAPS_SUFFIX
54 54
55#define VFS_CAP_REVISION_MASK 0xFF000000 55#define VFS_CAP_REVISION_MASK 0xFF000000
56#define VFS_CAP_REVISION_SHIFT 24
56#define VFS_CAP_FLAGS_MASK ~VFS_CAP_REVISION_MASK 57#define VFS_CAP_FLAGS_MASK ~VFS_CAP_REVISION_MASK
57#define VFS_CAP_FLAGS_EFFECTIVE 0x000001 58#define VFS_CAP_FLAGS_EFFECTIVE 0x000001
58 59
@@ -68,6 +69,9 @@ typedef struct __user_cap_data_struct {
68#define VFS_CAP_U32 VFS_CAP_U32_2 69#define VFS_CAP_U32 VFS_CAP_U32_2
69#define VFS_CAP_REVISION VFS_CAP_REVISION_2 70#define VFS_CAP_REVISION VFS_CAP_REVISION_2
70 71
72#ifdef CONFIG_SECURITY_FILE_CAPABILITIES
73extern int file_caps_enabled;
74#endif
71 75
72struct vfs_cap_data { 76struct vfs_cap_data {
73 __le32 magic_etc; /* Little endian */ 77 __le32 magic_etc; /* Little endian */
@@ -96,6 +100,13 @@ typedef struct kernel_cap_struct {
96 __u32 cap[_KERNEL_CAPABILITY_U32S]; 100 __u32 cap[_KERNEL_CAPABILITY_U32S];
97} kernel_cap_t; 101} kernel_cap_t;
98 102
103/* exact same as vfs_cap_data but in cpu endian and always filled completely */
104struct cpu_vfs_cap_data {
105 __u32 magic_etc;
106 kernel_cap_t permitted;
107 kernel_cap_t inheritable;
108};
109
99#define _USER_CAP_HEADER_SIZE (sizeof(struct __user_cap_header_struct)) 110#define _USER_CAP_HEADER_SIZE (sizeof(struct __user_cap_header_struct))
100#define _KERNEL_CAP_T_SIZE (sizeof(kernel_cap_t)) 111#define _KERNEL_CAP_T_SIZE (sizeof(kernel_cap_t))
101 112
@@ -454,6 +465,13 @@ static inline int cap_isclear(const kernel_cap_t a)
454 return 1; 465 return 1;
455} 466}
456 467
468/*
469 * Check if "a" is a subset of "set".
470 * return 1 if ALL of the capabilities in "a" are also in "set"
471 * cap_issubset(0101, 1111) will return 1
472 * return 0 if ANY of the capabilities in "a" are not in "set"
473 * cap_issubset(1111, 0101) will return 0
474 */
457static inline int cap_issubset(const kernel_cap_t a, const kernel_cap_t set) 475static inline int cap_issubset(const kernel_cap_t a, const kernel_cap_t set)
458{ 476{
459 kernel_cap_t dest; 477 kernel_cap_t dest;
@@ -501,8 +519,6 @@ extern const kernel_cap_t __cap_empty_set;
501extern const kernel_cap_t __cap_full_set; 519extern const kernel_cap_t __cap_full_set;
502extern const kernel_cap_t __cap_init_eff_set; 520extern const kernel_cap_t __cap_init_eff_set;
503 521
504kernel_cap_t cap_set_effective(const kernel_cap_t pE_new);
505
506/** 522/**
507 * has_capability - Determine if a task has a superior capability available 523 * has_capability - Determine if a task has a superior capability available
508 * @t: The task in question 524 * @t: The task in question
@@ -514,9 +530,14 @@ kernel_cap_t cap_set_effective(const kernel_cap_t pE_new);
514 * Note that this does not set PF_SUPERPRIV on the task. 530 * Note that this does not set PF_SUPERPRIV on the task.
515 */ 531 */
516#define has_capability(t, cap) (security_capable((t), (cap)) == 0) 532#define has_capability(t, cap) (security_capable((t), (cap)) == 0)
533#define has_capability_noaudit(t, cap) (security_capable_noaudit((t), (cap)) == 0)
517 534
518extern int capable(int cap); 535extern int capable(int cap);
519 536
537/* audit system wants to get cap info from files as well */
538struct dentry;
539extern int get_vfs_caps_from_disk(const struct dentry *dentry, struct cpu_vfs_cap_data *cpu_caps);
540
520#endif /* __KERNEL__ */ 541#endif /* __KERNEL__ */
521 542
522#endif /* !_LINUX_CAPABILITY_H */ 543#endif /* !_LINUX_CAPABILITY_H */
diff --git a/include/linux/cgroup_subsys.h b/include/linux/cgroup_subsys.h
index 9c22396e8b5..9c8d31bacf4 100644
--- a/include/linux/cgroup_subsys.h
+++ b/include/linux/cgroup_subsys.h
@@ -54,3 +54,9 @@ SUBSYS(freezer)
54#endif 54#endif
55 55
56/* */ 56/* */
57
58#ifdef CONFIG_NET_CLS_CGROUP
59SUBSYS(net_cls)
60#endif
61
62/* */
diff --git a/include/linux/console.h b/include/linux/console.h
index 248e6e3b9b7..a67a90cf826 100644
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -153,4 +153,8 @@ void vcs_remove_sysfs(struct tty_struct *tty);
153#define VESA_HSYNC_SUSPEND 2 153#define VESA_HSYNC_SUSPEND 2
154#define VESA_POWERDOWN 3 154#define VESA_POWERDOWN 3
155 155
156#ifdef CONFIG_VGA_CONSOLE
157extern bool vgacon_text_force(void);
158#endif
159
156#endif /* _LINUX_CONSOLE_H */ 160#endif /* _LINUX_CONSOLE_H */
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index d4bf52603e6..9f315382610 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -144,6 +144,7 @@
144typedef struct cpumask { DECLARE_BITMAP(bits, NR_CPUS); } cpumask_t; 144typedef struct cpumask { DECLARE_BITMAP(bits, NR_CPUS); } cpumask_t;
145extern cpumask_t _unused_cpumask_arg_; 145extern cpumask_t _unused_cpumask_arg_;
146 146
147#ifndef CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS
147#define cpu_set(cpu, dst) __cpu_set((cpu), &(dst)) 148#define cpu_set(cpu, dst) __cpu_set((cpu), &(dst))
148static inline void __cpu_set(int cpu, volatile cpumask_t *dstp) 149static inline void __cpu_set(int cpu, volatile cpumask_t *dstp)
149{ 150{
@@ -267,6 +268,26 @@ static inline void __cpus_shift_left(cpumask_t *dstp,
267{ 268{
268 bitmap_shift_left(dstp->bits, srcp->bits, n, nbits); 269 bitmap_shift_left(dstp->bits, srcp->bits, n, nbits);
269} 270}
271#endif /* !CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS */
272
273/**
274 * to_cpumask - convert an NR_CPUS bitmap to a struct cpumask *
275 * @bitmap: the bitmap
276 *
277 * There are a few places where cpumask_var_t isn't appropriate and
278 * static cpumasks must be used (eg. very early boot), yet we don't
279 * expose the definition of 'struct cpumask'.
280 *
281 * This does the conversion, and can be used as a constant initializer.
282 */
283#define to_cpumask(bitmap) \
284 ((struct cpumask *)(1 ? (bitmap) \
285 : (void *)sizeof(__check_is_bitmap(bitmap))))
286
287static inline int __check_is_bitmap(const unsigned long *bitmap)
288{
289 return 1;
290}
270 291
271/* 292/*
272 * Special-case data structure for "single bit set only" constant CPU masks. 293 * Special-case data structure for "single bit set only" constant CPU masks.
@@ -278,13 +299,14 @@ static inline void __cpus_shift_left(cpumask_t *dstp,
278extern const unsigned long 299extern const unsigned long
279 cpu_bit_bitmap[BITS_PER_LONG+1][BITS_TO_LONGS(NR_CPUS)]; 300 cpu_bit_bitmap[BITS_PER_LONG+1][BITS_TO_LONGS(NR_CPUS)];
280 301
281static inline const cpumask_t *get_cpu_mask(unsigned int cpu) 302static inline const struct cpumask *get_cpu_mask(unsigned int cpu)
282{ 303{
283 const unsigned long *p = cpu_bit_bitmap[1 + cpu % BITS_PER_LONG]; 304 const unsigned long *p = cpu_bit_bitmap[1 + cpu % BITS_PER_LONG];
284 p -= cpu / BITS_PER_LONG; 305 p -= cpu / BITS_PER_LONG;
285 return (const cpumask_t *)p; 306 return to_cpumask(p);
286} 307}
287 308
309#ifndef CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS
288/* 310/*
289 * In cases where we take the address of the cpumask immediately, 311 * In cases where we take the address of the cpumask immediately,
290 * gcc optimizes it out (it's a constant) and there's no huge stack 312 * gcc optimizes it out (it's a constant) and there's no huge stack
@@ -370,19 +392,22 @@ static inline void __cpus_fold(cpumask_t *dstp, const cpumask_t *origp,
370{ 392{
371 bitmap_fold(dstp->bits, origp->bits, sz, nbits); 393 bitmap_fold(dstp->bits, origp->bits, sz, nbits);
372} 394}
395#endif /* !CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS */
373 396
374#if NR_CPUS == 1 397#if NR_CPUS == 1
375 398
376#define nr_cpu_ids 1 399#define nr_cpu_ids 1
400#ifndef CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS
377#define first_cpu(src) ({ (void)(src); 0; }) 401#define first_cpu(src) ({ (void)(src); 0; })
378#define next_cpu(n, src) ({ (void)(src); 1; }) 402#define next_cpu(n, src) ({ (void)(src); 1; })
379#define any_online_cpu(mask) 0 403#define any_online_cpu(mask) 0
380#define for_each_cpu_mask(cpu, mask) \ 404#define for_each_cpu_mask(cpu, mask) \
381 for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask) 405 for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask)
382 406#endif /* !CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS */
383#else /* NR_CPUS > 1 */ 407#else /* NR_CPUS > 1 */
384 408
385extern int nr_cpu_ids; 409extern int nr_cpu_ids;
410#ifndef CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS
386int __first_cpu(const cpumask_t *srcp); 411int __first_cpu(const cpumask_t *srcp);
387int __next_cpu(int n, const cpumask_t *srcp); 412int __next_cpu(int n, const cpumask_t *srcp);
388int __any_online_cpu(const cpumask_t *mask); 413int __any_online_cpu(const cpumask_t *mask);
@@ -394,8 +419,10 @@ int __any_online_cpu(const cpumask_t *mask);
394 for ((cpu) = -1; \ 419 for ((cpu) = -1; \
395 (cpu) = next_cpu((cpu), (mask)), \ 420 (cpu) = next_cpu((cpu), (mask)), \
396 (cpu) < NR_CPUS; ) 421 (cpu) < NR_CPUS; )
422#endif /* !CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS */
397#endif 423#endif
398 424
425#ifndef CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS
399#if NR_CPUS <= 64 426#if NR_CPUS <= 64
400 427
401#define next_cpu_nr(n, src) next_cpu(n, src) 428#define next_cpu_nr(n, src) next_cpu(n, src)
@@ -413,77 +440,67 @@ int __next_cpu_nr(int n, const cpumask_t *srcp);
413 (cpu) < nr_cpu_ids; ) 440 (cpu) < nr_cpu_ids; )
414 441
415#endif /* NR_CPUS > 64 */ 442#endif /* NR_CPUS > 64 */
443#endif /* !CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS */
416 444
417/* 445/*
418 * The following particular system cpumasks and operations manage 446 * The following particular system cpumasks and operations manage
419 * possible, present, active and online cpus. Each of them is a fixed size 447 * possible, present, active and online cpus.
420 * bitmap of size NR_CPUS.
421 * 448 *
422 * #ifdef CONFIG_HOTPLUG_CPU 449 * cpu_possible_mask- has bit 'cpu' set iff cpu is populatable
423 * cpu_possible_map - has bit 'cpu' set iff cpu is populatable 450 * cpu_present_mask - has bit 'cpu' set iff cpu is populated
424 * cpu_present_map - has bit 'cpu' set iff cpu is populated 451 * cpu_online_mask - has bit 'cpu' set iff cpu available to scheduler
425 * cpu_online_map - has bit 'cpu' set iff cpu available to scheduler 452 * cpu_active_mask - has bit 'cpu' set iff cpu available to migration
426 * cpu_active_map - has bit 'cpu' set iff cpu available to migration
427 * #else
428 * cpu_possible_map - has bit 'cpu' set iff cpu is populated
429 * cpu_present_map - copy of cpu_possible_map
430 * cpu_online_map - has bit 'cpu' set iff cpu available to scheduler
431 * #endif
432 * 453 *
433 * In either case, NR_CPUS is fixed at compile time, as the static 454 * If !CONFIG_HOTPLUG_CPU, present == possible, and active == online.
434 * size of these bitmaps. The cpu_possible_map is fixed at boot
435 * time, as the set of CPU id's that it is possible might ever
436 * be plugged in at anytime during the life of that system boot.
437 * The cpu_present_map is dynamic(*), representing which CPUs
438 * are currently plugged in. And cpu_online_map is the dynamic
439 * subset of cpu_present_map, indicating those CPUs available
440 * for scheduling.
441 * 455 *
442 * If HOTPLUG is enabled, then cpu_possible_map is forced to have 456 * The cpu_possible_mask is fixed at boot time, as the set of CPU id's
457 * that it is possible might ever be plugged in at anytime during the
458 * life of that system boot. The cpu_present_mask is dynamic(*),
459 * representing which CPUs are currently plugged in. And
460 * cpu_online_mask is the dynamic subset of cpu_present_mask,
461 * indicating those CPUs available for scheduling.
462 *
463 * If HOTPLUG is enabled, then cpu_possible_mask is forced to have
443 * all NR_CPUS bits set, otherwise it is just the set of CPUs that 464 * all NR_CPUS bits set, otherwise it is just the set of CPUs that
444 * ACPI reports present at boot. 465 * ACPI reports present at boot.
445 * 466 *
446 * If HOTPLUG is enabled, then cpu_present_map varies dynamically, 467 * If HOTPLUG is enabled, then cpu_present_mask varies dynamically,
447 * depending on what ACPI reports as currently plugged in, otherwise 468 * depending on what ACPI reports as currently plugged in, otherwise
448 * cpu_present_map is just a copy of cpu_possible_map. 469 * cpu_present_mask is just a copy of cpu_possible_mask.
449 * 470 *
450 * (*) Well, cpu_present_map is dynamic in the hotplug case. If not 471 * (*) Well, cpu_present_mask is dynamic in the hotplug case. If not
451 * hotplug, it's a copy of cpu_possible_map, hence fixed at boot. 472 * hotplug, it's a copy of cpu_possible_mask, hence fixed at boot.
452 * 473 *
453 * Subtleties: 474 * Subtleties:
454 * 1) UP arch's (NR_CPUS == 1, CONFIG_SMP not defined) hardcode 475 * 1) UP arch's (NR_CPUS == 1, CONFIG_SMP not defined) hardcode
455 * assumption that their single CPU is online. The UP 476 * assumption that their single CPU is online. The UP
456 * cpu_{online,possible,present}_maps are placebos. Changing them 477 * cpu_{online,possible,present}_masks are placebos. Changing them
457 * will have no useful affect on the following num_*_cpus() 478 * will have no useful affect on the following num_*_cpus()
458 * and cpu_*() macros in the UP case. This ugliness is a UP 479 * and cpu_*() macros in the UP case. This ugliness is a UP
459 * optimization - don't waste any instructions or memory references 480 * optimization - don't waste any instructions or memory references
460 * asking if you're online or how many CPUs there are if there is 481 * asking if you're online or how many CPUs there are if there is
461 * only one CPU. 482 * only one CPU.
462 * 2) Most SMP arch's #define some of these maps to be some
463 * other map specific to that arch. Therefore, the following
464 * must be #define macros, not inlines. To see why, examine
465 * the assembly code produced by the following. Note that
466 * set1() writes phys_x_map, but set2() writes x_map:
467 * int x_map, phys_x_map;
468 * #define set1(a) x_map = a
469 * inline void set2(int a) { x_map = a; }
470 * #define x_map phys_x_map
471 * main(){ set1(3); set2(5); }
472 */ 483 */
473 484
474extern cpumask_t cpu_possible_map; 485extern const struct cpumask *const cpu_possible_mask;
475extern cpumask_t cpu_online_map; 486extern const struct cpumask *const cpu_online_mask;
476extern cpumask_t cpu_present_map; 487extern const struct cpumask *const cpu_present_mask;
477extern cpumask_t cpu_active_map; 488extern const struct cpumask *const cpu_active_mask;
489
490/* These strip const, as traditionally they weren't const. */
491#define cpu_possible_map (*(cpumask_t *)cpu_possible_mask)
492#define cpu_online_map (*(cpumask_t *)cpu_online_mask)
493#define cpu_present_map (*(cpumask_t *)cpu_present_mask)
494#define cpu_active_map (*(cpumask_t *)cpu_active_mask)
478 495
479#if NR_CPUS > 1 496#if NR_CPUS > 1
480#define num_online_cpus() cpus_weight_nr(cpu_online_map) 497#define num_online_cpus() cpumask_weight(cpu_online_mask)
481#define num_possible_cpus() cpus_weight_nr(cpu_possible_map) 498#define num_possible_cpus() cpumask_weight(cpu_possible_mask)
482#define num_present_cpus() cpus_weight_nr(cpu_present_map) 499#define num_present_cpus() cpumask_weight(cpu_present_mask)
483#define cpu_online(cpu) cpu_isset((cpu), cpu_online_map) 500#define cpu_online(cpu) cpumask_test_cpu((cpu), cpu_online_mask)
484#define cpu_possible(cpu) cpu_isset((cpu), cpu_possible_map) 501#define cpu_possible(cpu) cpumask_test_cpu((cpu), cpu_possible_mask)
485#define cpu_present(cpu) cpu_isset((cpu), cpu_present_map) 502#define cpu_present(cpu) cpumask_test_cpu((cpu), cpu_present_mask)
486#define cpu_active(cpu) cpu_isset((cpu), cpu_active_map) 503#define cpu_active(cpu) cpumask_test_cpu((cpu), cpu_active_mask)
487#else 504#else
488#define num_online_cpus() 1 505#define num_online_cpus() 1
489#define num_possible_cpus() 1 506#define num_possible_cpus() 1
@@ -496,10 +513,6 @@ extern cpumask_t cpu_active_map;
496 513
497#define cpu_is_offline(cpu) unlikely(!cpu_online(cpu)) 514#define cpu_is_offline(cpu) unlikely(!cpu_online(cpu))
498 515
499#define for_each_possible_cpu(cpu) for_each_cpu_mask_nr((cpu), cpu_possible_map)
500#define for_each_online_cpu(cpu) for_each_cpu_mask_nr((cpu), cpu_online_map)
501#define for_each_present_cpu(cpu) for_each_cpu_mask_nr((cpu), cpu_present_map)
502
503/* These are the new versions of the cpumask operators: passed by pointer. 516/* These are the new versions of the cpumask operators: passed by pointer.
504 * The older versions will be implemented in terms of these, then deleted. */ 517 * The older versions will be implemented in terms of these, then deleted. */
505#define cpumask_bits(maskp) ((maskp)->bits) 518#define cpumask_bits(maskp) ((maskp)->bits)
@@ -687,7 +700,7 @@ static inline void cpumask_clear_cpu(int cpu, struct cpumask *dstp)
687 * No static inline type checking - see Subtlety (1) above. 700 * No static inline type checking - see Subtlety (1) above.
688 */ 701 */
689#define cpumask_test_cpu(cpu, cpumask) \ 702#define cpumask_test_cpu(cpu, cpumask) \
690 test_bit(cpumask_check(cpu), (cpumask)->bits) 703 test_bit(cpumask_check(cpu), cpumask_bits((cpumask)))
691 704
692/** 705/**
693 * cpumask_test_and_set_cpu - atomically test and set a cpu in a cpumask 706 * cpumask_test_and_set_cpu - atomically test and set a cpu in a cpumask
@@ -930,7 +943,7 @@ static inline void cpumask_copy(struct cpumask *dstp,
930static inline int cpumask_scnprintf(char *buf, int len, 943static inline int cpumask_scnprintf(char *buf, int len,
931 const struct cpumask *srcp) 944 const struct cpumask *srcp)
932{ 945{
933 return bitmap_scnprintf(buf, len, srcp->bits, nr_cpumask_bits); 946 return bitmap_scnprintf(buf, len, cpumask_bits(srcp), nr_cpumask_bits);
934} 947}
935 948
936/** 949/**
@@ -944,7 +957,7 @@ static inline int cpumask_scnprintf(char *buf, int len,
944static inline int cpumask_parse_user(const char __user *buf, int len, 957static inline int cpumask_parse_user(const char __user *buf, int len,
945 struct cpumask *dstp) 958 struct cpumask *dstp)
946{ 959{
947 return bitmap_parse_user(buf, len, dstp->bits, nr_cpumask_bits); 960 return bitmap_parse_user(buf, len, cpumask_bits(dstp), nr_cpumask_bits);
948} 961}
949 962
950/** 963/**
@@ -959,7 +972,8 @@ static inline int cpumask_parse_user(const char __user *buf, int len,
959static inline int cpulist_scnprintf(char *buf, int len, 972static inline int cpulist_scnprintf(char *buf, int len,
960 const struct cpumask *srcp) 973 const struct cpumask *srcp)
961{ 974{
962 return bitmap_scnlistprintf(buf, len, srcp->bits, nr_cpumask_bits); 975 return bitmap_scnlistprintf(buf, len, cpumask_bits(srcp),
976 nr_cpumask_bits);
963} 977}
964 978
965/** 979/**
@@ -972,26 +986,7 @@ static inline int cpulist_scnprintf(char *buf, int len,
972 */ 986 */
973static inline int cpulist_parse(const char *buf, struct cpumask *dstp) 987static inline int cpulist_parse(const char *buf, struct cpumask *dstp)
974{ 988{
975 return bitmap_parselist(buf, dstp->bits, nr_cpumask_bits); 989 return bitmap_parselist(buf, cpumask_bits(dstp), nr_cpumask_bits);
976}
977
978/**
979 * to_cpumask - convert an NR_CPUS bitmap to a struct cpumask *
980 * @bitmap: the bitmap
981 *
982 * There are a few places where cpumask_var_t isn't appropriate and
983 * static cpumasks must be used (eg. very early boot), yet we don't
984 * expose the definition of 'struct cpumask'.
985 *
986 * This does the conversion, and can be used as a constant initializer.
987 */
988#define to_cpumask(bitmap) \
989 ((struct cpumask *)(1 ? (bitmap) \
990 : (void *)sizeof(__check_is_bitmap(bitmap))))
991
992static inline int __check_is_bitmap(const unsigned long *bitmap)
993{
994 return 1;
995} 990}
996 991
997/** 992/**
@@ -1025,6 +1020,7 @@ static inline size_t cpumask_size(void)
1025#ifdef CONFIG_CPUMASK_OFFSTACK 1020#ifdef CONFIG_CPUMASK_OFFSTACK
1026typedef struct cpumask *cpumask_var_t; 1021typedef struct cpumask *cpumask_var_t;
1027 1022
1023bool alloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node);
1028bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags); 1024bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags);
1029void alloc_bootmem_cpumask_var(cpumask_var_t *mask); 1025void alloc_bootmem_cpumask_var(cpumask_var_t *mask);
1030void free_cpumask_var(cpumask_var_t mask); 1026void free_cpumask_var(cpumask_var_t mask);
@@ -1038,6 +1034,12 @@ static inline bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags)
1038 return true; 1034 return true;
1039} 1035}
1040 1036
1037static inline bool alloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags,
1038 int node)
1039{
1040 return true;
1041}
1042
1041static inline void alloc_bootmem_cpumask_var(cpumask_var_t *mask) 1043static inline void alloc_bootmem_cpumask_var(cpumask_var_t *mask)
1042{ 1044{
1043} 1045}
@@ -1051,12 +1053,6 @@ static inline void free_bootmem_cpumask_var(cpumask_var_t mask)
1051} 1053}
1052#endif /* CONFIG_CPUMASK_OFFSTACK */ 1054#endif /* CONFIG_CPUMASK_OFFSTACK */
1053 1055
1054/* The pointer versions of the maps, these will become the primary versions. */
1055#define cpu_possible_mask ((const struct cpumask *)&cpu_possible_map)
1056#define cpu_online_mask ((const struct cpumask *)&cpu_online_map)
1057#define cpu_present_mask ((const struct cpumask *)&cpu_present_map)
1058#define cpu_active_mask ((const struct cpumask *)&cpu_active_map)
1059
1060/* It's common to want to use cpu_all_mask in struct member initializers, 1056/* It's common to want to use cpu_all_mask in struct member initializers,
1061 * so it has to refer to an address rather than a pointer. */ 1057 * so it has to refer to an address rather than a pointer. */
1062extern const DECLARE_BITMAP(cpu_all_bits, NR_CPUS); 1058extern const DECLARE_BITMAP(cpu_all_bits, NR_CPUS);
@@ -1065,51 +1061,16 @@ extern const DECLARE_BITMAP(cpu_all_bits, NR_CPUS);
1065/* First bits of cpu_bit_bitmap are in fact unset. */ 1061/* First bits of cpu_bit_bitmap are in fact unset. */
1066#define cpu_none_mask to_cpumask(cpu_bit_bitmap[0]) 1062#define cpu_none_mask to_cpumask(cpu_bit_bitmap[0])
1067 1063
1068/* Wrappers for arch boot code to manipulate normally-constant masks */ 1064#define for_each_possible_cpu(cpu) for_each_cpu((cpu), cpu_possible_mask)
1069static inline void set_cpu_possible(unsigned int cpu, bool possible) 1065#define for_each_online_cpu(cpu) for_each_cpu((cpu), cpu_online_mask)
1070{ 1066#define for_each_present_cpu(cpu) for_each_cpu((cpu), cpu_present_mask)
1071 if (possible)
1072 cpumask_set_cpu(cpu, &cpu_possible_map);
1073 else
1074 cpumask_clear_cpu(cpu, &cpu_possible_map);
1075}
1076
1077static inline void set_cpu_present(unsigned int cpu, bool present)
1078{
1079 if (present)
1080 cpumask_set_cpu(cpu, &cpu_present_map);
1081 else
1082 cpumask_clear_cpu(cpu, &cpu_present_map);
1083}
1084
1085static inline void set_cpu_online(unsigned int cpu, bool online)
1086{
1087 if (online)
1088 cpumask_set_cpu(cpu, &cpu_online_map);
1089 else
1090 cpumask_clear_cpu(cpu, &cpu_online_map);
1091}
1092 1067
1093static inline void set_cpu_active(unsigned int cpu, bool active) 1068/* Wrappers for arch boot code to manipulate normally-constant masks */
1094{ 1069void set_cpu_possible(unsigned int cpu, bool possible);
1095 if (active) 1070void set_cpu_present(unsigned int cpu, bool present);
1096 cpumask_set_cpu(cpu, &cpu_active_map); 1071void set_cpu_online(unsigned int cpu, bool online);
1097 else 1072void set_cpu_active(unsigned int cpu, bool active);
1098 cpumask_clear_cpu(cpu, &cpu_active_map); 1073void init_cpu_present(const struct cpumask *src);
1099} 1074void init_cpu_possible(const struct cpumask *src);
1100 1075void init_cpu_online(const struct cpumask *src);
1101static inline void init_cpu_present(const struct cpumask *src)
1102{
1103 cpumask_copy(&cpu_present_map, src);
1104}
1105
1106static inline void init_cpu_possible(const struct cpumask *src)
1107{
1108 cpumask_copy(&cpu_possible_map, src);
1109}
1110
1111static inline void init_cpu_online(const struct cpumask *src)
1112{
1113 cpumask_copy(&cpu_online_map, src);
1114}
1115#endif /* __LINUX_CPUMASK_H */ 1076#endif /* __LINUX_CPUMASK_H */
diff --git a/include/linux/crc32c.h b/include/linux/crc32c.h
index 508f512e5a2..bd8b44d96bd 100644
--- a/include/linux/crc32c.h
+++ b/include/linux/crc32c.h
@@ -3,9 +3,9 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5 5
6extern u32 crc32c_le(u32 crc, unsigned char const *address, size_t length); 6extern u32 crc32c(u32 crc, const void *address, unsigned int length);
7extern u32 crc32c_be(u32 crc, unsigned char const *address, size_t length);
8 7
9#define crc32c(seed, data, length) crc32c_le(seed, (unsigned char const *)data, length) 8/* This macro exists for backwards-compatibility. */
9#define crc32c_le crc32c
10 10
11#endif /* _LINUX_CRC32C_H */ 11#endif /* _LINUX_CRC32C_H */
diff --git a/include/linux/cred.h b/include/linux/cred.h
index b69222cc1fd..3282ee4318e 100644
--- a/include/linux/cred.h
+++ b/include/linux/cred.h
@@ -1,4 +1,4 @@
1/* Credentials management 1/* Credentials management - see Documentation/credentials.txt
2 * 2 *
3 * Copyright (C) 2008 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2008 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
@@ -12,39 +12,335 @@
12#ifndef _LINUX_CRED_H 12#ifndef _LINUX_CRED_H
13#define _LINUX_CRED_H 13#define _LINUX_CRED_H
14 14
15#define get_current_user() (get_uid(current->user)) 15#include <linux/capability.h>
16#include <linux/key.h>
17#include <asm/atomic.h>
16 18
17#define task_uid(task) ((task)->uid) 19struct user_struct;
18#define task_gid(task) ((task)->gid) 20struct cred;
19#define task_euid(task) ((task)->euid) 21struct inode;
20#define task_egid(task) ((task)->egid)
21 22
22#define current_uid() (current->uid) 23/*
23#define current_gid() (current->gid) 24 * COW Supplementary groups list
24#define current_euid() (current->euid) 25 */
25#define current_egid() (current->egid) 26#define NGROUPS_SMALL 32
26#define current_suid() (current->suid) 27#define NGROUPS_PER_BLOCK ((unsigned int)(PAGE_SIZE / sizeof(gid_t)))
27#define current_sgid() (current->sgid) 28
28#define current_fsuid() (current->fsuid) 29struct group_info {
29#define current_fsgid() (current->fsgid) 30 atomic_t usage;
30#define current_cap() (current->cap_effective) 31 int ngroups;
32 int nblocks;
33 gid_t small_block[NGROUPS_SMALL];
34 gid_t *blocks[0];
35};
36
37/**
38 * get_group_info - Get a reference to a group info structure
39 * @group_info: The group info to reference
40 *
41 * This gets a reference to a set of supplementary groups.
42 *
43 * If the caller is accessing a task's credentials, they must hold the RCU read
44 * lock when reading.
45 */
46static inline struct group_info *get_group_info(struct group_info *gi)
47{
48 atomic_inc(&gi->usage);
49 return gi;
50}
51
52/**
53 * put_group_info - Release a reference to a group info structure
54 * @group_info: The group info to release
55 */
56#define put_group_info(group_info) \
57do { \
58 if (atomic_dec_and_test(&(group_info)->usage)) \
59 groups_free(group_info); \
60} while (0)
61
62extern struct group_info *groups_alloc(int);
63extern struct group_info init_groups;
64extern void groups_free(struct group_info *);
65extern int set_current_groups(struct group_info *);
66extern int set_groups(struct cred *, struct group_info *);
67extern int groups_search(const struct group_info *, gid_t);
68
69/* access the groups "array" with this macro */
70#define GROUP_AT(gi, i) \
71 ((gi)->blocks[(i) / NGROUPS_PER_BLOCK][(i) % NGROUPS_PER_BLOCK])
72
73extern int in_group_p(gid_t);
74extern int in_egroup_p(gid_t);
75
76/*
77 * The common credentials for a thread group
78 * - shared by CLONE_THREAD
79 */
80#ifdef CONFIG_KEYS
81struct thread_group_cred {
82 atomic_t usage;
83 pid_t tgid; /* thread group process ID */
84 spinlock_t lock;
85 struct key *session_keyring; /* keyring inherited over fork */
86 struct key *process_keyring; /* keyring private to this process */
87 struct rcu_head rcu; /* RCU deletion hook */
88};
89#endif
90
91/*
92 * The security context of a task
93 *
94 * The parts of the context break down into two categories:
95 *
96 * (1) The objective context of a task. These parts are used when some other
97 * task is attempting to affect this one.
98 *
99 * (2) The subjective context. These details are used when the task is acting
100 * upon another object, be that a file, a task, a key or whatever.
101 *
102 * Note that some members of this structure belong to both categories - the
103 * LSM security pointer for instance.
104 *
105 * A task has two security pointers. task->real_cred points to the objective
106 * context that defines that task's actual details. The objective part of this
107 * context is used whenever that task is acted upon.
108 *
109 * task->cred points to the subjective context that defines the details of how
110 * that task is going to act upon another object. This may be overridden
111 * temporarily to point to another security context, but normally points to the
112 * same context as task->real_cred.
113 */
114struct cred {
115 atomic_t usage;
116 uid_t uid; /* real UID of the task */
117 gid_t gid; /* real GID of the task */
118 uid_t suid; /* saved UID of the task */
119 gid_t sgid; /* saved GID of the task */
120 uid_t euid; /* effective UID of the task */
121 gid_t egid; /* effective GID of the task */
122 uid_t fsuid; /* UID for VFS ops */
123 gid_t fsgid; /* GID for VFS ops */
124 unsigned securebits; /* SUID-less security management */
125 kernel_cap_t cap_inheritable; /* caps our children can inherit */
126 kernel_cap_t cap_permitted; /* caps we're permitted */
127 kernel_cap_t cap_effective; /* caps we can actually use */
128 kernel_cap_t cap_bset; /* capability bounding set */
129#ifdef CONFIG_KEYS
130 unsigned char jit_keyring; /* default keyring to attach requested
131 * keys to */
132 struct key *thread_keyring; /* keyring private to this thread */
133 struct key *request_key_auth; /* assumed request_key authority */
134 struct thread_group_cred *tgcred; /* thread-group shared credentials */
135#endif
136#ifdef CONFIG_SECURITY
137 void *security; /* subjective LSM security */
138#endif
139 struct user_struct *user; /* real user ID subscription */
140 struct group_info *group_info; /* supplementary groups for euid/fsgid */
141 struct rcu_head rcu; /* RCU deletion hook */
142};
143
144extern void __put_cred(struct cred *);
145extern int copy_creds(struct task_struct *, unsigned long);
146extern struct cred *prepare_creds(void);
147extern struct cred *prepare_exec_creds(void);
148extern struct cred *prepare_usermodehelper_creds(void);
149extern int commit_creds(struct cred *);
150extern void abort_creds(struct cred *);
151extern const struct cred *override_creds(const struct cred *);
152extern void revert_creds(const struct cred *);
153extern struct cred *prepare_kernel_cred(struct task_struct *);
154extern int change_create_files_as(struct cred *, struct inode *);
155extern int set_security_override(struct cred *, u32);
156extern int set_security_override_from_ctx(struct cred *, const char *);
157extern int set_create_files_as(struct cred *, struct inode *);
158extern void __init cred_init(void);
159
160/**
161 * get_new_cred - Get a reference on a new set of credentials
162 * @cred: The new credentials to reference
163 *
164 * Get a reference on the specified set of new credentials. The caller must
165 * release the reference.
166 */
167static inline struct cred *get_new_cred(struct cred *cred)
168{
169 atomic_inc(&cred->usage);
170 return cred;
171}
172
173/**
174 * get_cred - Get a reference on a set of credentials
175 * @cred: The credentials to reference
176 *
177 * Get a reference on the specified set of credentials. The caller must
178 * release the reference.
179 *
180 * This is used to deal with a committed set of credentials. Although the
181 * pointer is const, this will temporarily discard the const and increment the
182 * usage count. The purpose of this is to attempt to catch at compile time the
183 * accidental alteration of a set of credentials that should be considered
184 * immutable.
185 */
186static inline const struct cred *get_cred(const struct cred *cred)
187{
188 return get_new_cred((struct cred *) cred);
189}
190
191/**
192 * put_cred - Release a reference to a set of credentials
193 * @cred: The credentials to release
194 *
195 * Release a reference to a set of credentials, deleting them when the last ref
196 * is released.
197 *
198 * This takes a const pointer to a set of credentials because the credentials
199 * on task_struct are attached by const pointers to prevent accidental
200 * alteration of otherwise immutable credential sets.
201 */
202static inline void put_cred(const struct cred *_cred)
203{
204 struct cred *cred = (struct cred *) _cred;
205
206 BUG_ON(atomic_read(&(cred)->usage) <= 0);
207 if (atomic_dec_and_test(&(cred)->usage))
208 __put_cred(cred);
209}
210
211/**
212 * current_cred - Access the current task's subjective credentials
213 *
214 * Access the subjective credentials of the current task.
215 */
216#define current_cred() \
217 (current->cred)
218
219/**
220 * __task_cred - Access a task's objective credentials
221 * @task: The task to query
222 *
223 * Access the objective credentials of a task. The caller must hold the RCU
224 * readlock.
225 *
226 * The caller must make sure task doesn't go away, either by holding a ref on
227 * task or by holding tasklist_lock to prevent it from being unlinked.
228 */
229#define __task_cred(task) \
230 ((const struct cred *)(rcu_dereference((task)->real_cred)))
231
232/**
233 * get_task_cred - Get another task's objective credentials
234 * @task: The task to query
235 *
236 * Get the objective credentials of a task, pinning them so that they can't go
237 * away. Accessing a task's credentials directly is not permitted.
238 *
239 * The caller must make sure task doesn't go away, either by holding a ref on
240 * task or by holding tasklist_lock to prevent it from being unlinked.
241 */
242#define get_task_cred(task) \
243({ \
244 struct cred *__cred; \
245 rcu_read_lock(); \
246 __cred = (struct cred *) __task_cred((task)); \
247 get_cred(__cred); \
248 rcu_read_unlock(); \
249 __cred; \
250})
251
252/**
253 * get_current_cred - Get the current task's subjective credentials
254 *
255 * Get the subjective credentials of the current task, pinning them so that
256 * they can't go away. Accessing the current task's credentials directly is
257 * not permitted.
258 */
259#define get_current_cred() \
260 (get_cred(current_cred()))
261
262/**
263 * get_current_user - Get the current task's user_struct
264 *
265 * Get the user record of the current task, pinning it so that it can't go
266 * away.
267 */
268#define get_current_user() \
269({ \
270 struct user_struct *__u; \
271 struct cred *__cred; \
272 __cred = (struct cred *) current_cred(); \
273 __u = get_uid(__cred->user); \
274 __u; \
275})
276
277/**
278 * get_current_groups - Get the current task's supplementary group list
279 *
280 * Get the supplementary group list of the current task, pinning it so that it
281 * can't go away.
282 */
283#define get_current_groups() \
284({ \
285 struct group_info *__groups; \
286 struct cred *__cred; \
287 __cred = (struct cred *) current_cred(); \
288 __groups = get_group_info(__cred->group_info); \
289 __groups; \
290})
291
292#define task_cred_xxx(task, xxx) \
293({ \
294 __typeof__(((struct cred *)NULL)->xxx) ___val; \
295 rcu_read_lock(); \
296 ___val = __task_cred((task))->xxx; \
297 rcu_read_unlock(); \
298 ___val; \
299})
300
301#define task_uid(task) (task_cred_xxx((task), uid))
302#define task_euid(task) (task_cred_xxx((task), euid))
303
304#define current_cred_xxx(xxx) \
305({ \
306 current->cred->xxx; \
307})
308
309#define current_uid() (current_cred_xxx(uid))
310#define current_gid() (current_cred_xxx(gid))
311#define current_euid() (current_cred_xxx(euid))
312#define current_egid() (current_cred_xxx(egid))
313#define current_suid() (current_cred_xxx(suid))
314#define current_sgid() (current_cred_xxx(sgid))
315#define current_fsuid() (current_cred_xxx(fsuid))
316#define current_fsgid() (current_cred_xxx(fsgid))
317#define current_cap() (current_cred_xxx(cap_effective))
318#define current_user() (current_cred_xxx(user))
319#define current_user_ns() (current_cred_xxx(user)->user_ns)
320#define current_security() (current_cred_xxx(security))
31 321
32#define current_uid_gid(_uid, _gid) \ 322#define current_uid_gid(_uid, _gid) \
33do { \ 323do { \
34 *(_uid) = current->uid; \ 324 const struct cred *__cred; \
35 *(_gid) = current->gid; \ 325 __cred = current_cred(); \
326 *(_uid) = __cred->uid; \
327 *(_gid) = __cred->gid; \
36} while(0) 328} while(0)
37 329
38#define current_euid_egid(_uid, _gid) \ 330#define current_euid_egid(_euid, _egid) \
39do { \ 331do { \
40 *(_uid) = current->euid; \ 332 const struct cred *__cred; \
41 *(_gid) = current->egid; \ 333 __cred = current_cred(); \
334 *(_euid) = __cred->euid; \
335 *(_egid) = __cred->egid; \
42} while(0) 336} while(0)
43 337
44#define current_fsuid_fsgid(_uid, _gid) \ 338#define current_fsuid_fsgid(_fsuid, _fsgid) \
45do { \ 339do { \
46 *(_uid) = current->fsuid; \ 340 const struct cred *__cred; \
47 *(_gid) = current->fsgid; \ 341 __cred = current_cred(); \
342 *(_fsuid) = __cred->fsuid; \
343 *(_fsgid) = __cred->fsgid; \
48} while(0) 344} while(0)
49 345
50#endif /* _LINUX_CRED_H */ 346#endif /* _LINUX_CRED_H */
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index 3d2317e4af2..3bacd71509f 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -36,7 +36,8 @@
36#define CRYPTO_ALG_TYPE_ABLKCIPHER 0x00000005 36#define CRYPTO_ALG_TYPE_ABLKCIPHER 0x00000005
37#define CRYPTO_ALG_TYPE_GIVCIPHER 0x00000006 37#define CRYPTO_ALG_TYPE_GIVCIPHER 0x00000006
38#define CRYPTO_ALG_TYPE_DIGEST 0x00000008 38#define CRYPTO_ALG_TYPE_DIGEST 0x00000008
39#define CRYPTO_ALG_TYPE_HASH 0x00000009 39#define CRYPTO_ALG_TYPE_HASH 0x00000008
40#define CRYPTO_ALG_TYPE_SHASH 0x00000009
40#define CRYPTO_ALG_TYPE_AHASH 0x0000000a 41#define CRYPTO_ALG_TYPE_AHASH 0x0000000a
41#define CRYPTO_ALG_TYPE_RNG 0x0000000c 42#define CRYPTO_ALG_TYPE_RNG 0x0000000c
42 43
@@ -220,6 +221,7 @@ struct ablkcipher_alg {
220 221
221struct ahash_alg { 222struct ahash_alg {
222 int (*init)(struct ahash_request *req); 223 int (*init)(struct ahash_request *req);
224 int (*reinit)(struct ahash_request *req);
223 int (*update)(struct ahash_request *req); 225 int (*update)(struct ahash_request *req);
224 int (*final)(struct ahash_request *req); 226 int (*final)(struct ahash_request *req);
225 int (*digest)(struct ahash_request *req); 227 int (*digest)(struct ahash_request *req);
@@ -480,6 +482,8 @@ struct crypto_tfm {
480 struct compress_tfm compress; 482 struct compress_tfm compress;
481 struct rng_tfm rng; 483 struct rng_tfm rng;
482 } crt_u; 484 } crt_u;
485
486 void (*exit)(struct crypto_tfm *tfm);
483 487
484 struct crypto_alg *__crt_alg; 488 struct crypto_alg *__crt_alg;
485 489
@@ -544,7 +548,9 @@ struct crypto_attr_u32 {
544 * Transform user interface. 548 * Transform user interface.
545 */ 549 */
546 550
547struct crypto_tfm *crypto_alloc_tfm(const char *alg_name, u32 tfm_flags); 551struct crypto_tfm *crypto_alloc_tfm(const char *alg_name,
552 const struct crypto_type *frontend,
553 u32 type, u32 mask);
548struct crypto_tfm *crypto_alloc_base(const char *alg_name, u32 type, u32 mask); 554struct crypto_tfm *crypto_alloc_base(const char *alg_name, u32 type, u32 mask);
549void crypto_free_tfm(struct crypto_tfm *tfm); 555void crypto_free_tfm(struct crypto_tfm *tfm);
550 556
diff --git a/include/linux/dcbnl.h b/include/linux/dcbnl.h
new file mode 100644
index 00000000000..b0ef274e003
--- /dev/null
+++ b/include/linux/dcbnl.h
@@ -0,0 +1,340 @@
1/*
2 * Copyright (c) 2008, Intel Corporation.
3 *
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,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
15 * Place - Suite 330, Boston, MA 02111-1307 USA.
16 *
17 * Author: Lucy Liu <lucy.liu@intel.com>
18 */
19
20#ifndef __LINUX_DCBNL_H__
21#define __LINUX_DCBNL_H__
22
23#define DCB_PROTO_VERSION 1
24
25struct dcbmsg {
26 unsigned char dcb_family;
27 __u8 cmd;
28 __u16 dcb_pad;
29};
30
31/**
32 * enum dcbnl_commands - supported DCB commands
33 *
34 * @DCB_CMD_UNDEFINED: unspecified command to catch errors
35 * @DCB_CMD_GSTATE: request the state of DCB in the device
36 * @DCB_CMD_SSTATE: set the state of DCB in the device
37 * @DCB_CMD_PGTX_GCFG: request the priority group configuration for Tx
38 * @DCB_CMD_PGTX_SCFG: set the priority group configuration for Tx
39 * @DCB_CMD_PGRX_GCFG: request the priority group configuration for Rx
40 * @DCB_CMD_PGRX_SCFG: set the priority group configuration for Rx
41 * @DCB_CMD_PFC_GCFG: request the priority flow control configuration
42 * @DCB_CMD_PFC_SCFG: set the priority flow control configuration
43 * @DCB_CMD_SET_ALL: apply all changes to the underlying device
44 * @DCB_CMD_GPERM_HWADDR: get the permanent MAC address of the underlying
45 * device. Only useful when using bonding.
46 * @DCB_CMD_GCAP: request the DCB capabilities of the device
47 * @DCB_CMD_GNUMTCS: get the number of traffic classes currently supported
48 * @DCB_CMD_SNUMTCS: set the number of traffic classes
49 * @DCB_CMD_GBCN: set backward congestion notification configuration
50 * @DCB_CMD_SBCN: get backward congestion notification configration.
51 */
52enum dcbnl_commands {
53 DCB_CMD_UNDEFINED,
54
55 DCB_CMD_GSTATE,
56 DCB_CMD_SSTATE,
57
58 DCB_CMD_PGTX_GCFG,
59 DCB_CMD_PGTX_SCFG,
60 DCB_CMD_PGRX_GCFG,
61 DCB_CMD_PGRX_SCFG,
62
63 DCB_CMD_PFC_GCFG,
64 DCB_CMD_PFC_SCFG,
65
66 DCB_CMD_SET_ALL,
67
68 DCB_CMD_GPERM_HWADDR,
69
70 DCB_CMD_GCAP,
71
72 DCB_CMD_GNUMTCS,
73 DCB_CMD_SNUMTCS,
74
75 DCB_CMD_PFC_GSTATE,
76 DCB_CMD_PFC_SSTATE,
77
78 DCB_CMD_BCN_GCFG,
79 DCB_CMD_BCN_SCFG,
80
81 __DCB_CMD_ENUM_MAX,
82 DCB_CMD_MAX = __DCB_CMD_ENUM_MAX - 1,
83};
84
85/**
86 * enum dcbnl_attrs - DCB top-level netlink attributes
87 *
88 * @DCB_ATTR_UNDEFINED: unspecified attribute to catch errors
89 * @DCB_ATTR_IFNAME: interface name of the underlying device (NLA_STRING)
90 * @DCB_ATTR_STATE: enable state of DCB in the device (NLA_U8)
91 * @DCB_ATTR_PFC_STATE: enable state of PFC in the device (NLA_U8)
92 * @DCB_ATTR_PFC_CFG: priority flow control configuration (NLA_NESTED)
93 * @DCB_ATTR_NUM_TC: number of traffic classes supported in the device (NLA_U8)
94 * @DCB_ATTR_PG_CFG: priority group configuration (NLA_NESTED)
95 * @DCB_ATTR_SET_ALL: bool to commit changes to hardware or not (NLA_U8)
96 * @DCB_ATTR_PERM_HWADDR: MAC address of the physical device (NLA_NESTED)
97 * @DCB_ATTR_CAP: DCB capabilities of the device (NLA_NESTED)
98 * @DCB_ATTR_NUMTCS: number of traffic classes supported (NLA_NESTED)
99 * @DCB_ATTR_BCN: backward congestion notification configuration (NLA_NESTED)
100 */
101enum dcbnl_attrs {
102 DCB_ATTR_UNDEFINED,
103
104 DCB_ATTR_IFNAME,
105 DCB_ATTR_STATE,
106 DCB_ATTR_PFC_STATE,
107 DCB_ATTR_PFC_CFG,
108 DCB_ATTR_NUM_TC,
109 DCB_ATTR_PG_CFG,
110 DCB_ATTR_SET_ALL,
111 DCB_ATTR_PERM_HWADDR,
112 DCB_ATTR_CAP,
113 DCB_ATTR_NUMTCS,
114 DCB_ATTR_BCN,
115
116 __DCB_ATTR_ENUM_MAX,
117 DCB_ATTR_MAX = __DCB_ATTR_ENUM_MAX - 1,
118};
119
120/**
121 * enum dcbnl_pfc_attrs - DCB Priority Flow Control user priority nested attrs
122 *
123 * @DCB_PFC_UP_ATTR_UNDEFINED: unspecified attribute to catch errors
124 * @DCB_PFC_UP_ATTR_0: Priority Flow Control value for User Priority 0 (NLA_U8)
125 * @DCB_PFC_UP_ATTR_1: Priority Flow Control value for User Priority 1 (NLA_U8)
126 * @DCB_PFC_UP_ATTR_2: Priority Flow Control value for User Priority 2 (NLA_U8)
127 * @DCB_PFC_UP_ATTR_3: Priority Flow Control value for User Priority 3 (NLA_U8)
128 * @DCB_PFC_UP_ATTR_4: Priority Flow Control value for User Priority 4 (NLA_U8)
129 * @DCB_PFC_UP_ATTR_5: Priority Flow Control value for User Priority 5 (NLA_U8)
130 * @DCB_PFC_UP_ATTR_6: Priority Flow Control value for User Priority 6 (NLA_U8)
131 * @DCB_PFC_UP_ATTR_7: Priority Flow Control value for User Priority 7 (NLA_U8)
132 * @DCB_PFC_UP_ATTR_MAX: highest attribute number currently defined
133 * @DCB_PFC_UP_ATTR_ALL: apply to all priority flow control attrs (NLA_FLAG)
134 *
135 */
136enum dcbnl_pfc_up_attrs {
137 DCB_PFC_UP_ATTR_UNDEFINED,
138
139 DCB_PFC_UP_ATTR_0,
140 DCB_PFC_UP_ATTR_1,
141 DCB_PFC_UP_ATTR_2,
142 DCB_PFC_UP_ATTR_3,
143 DCB_PFC_UP_ATTR_4,
144 DCB_PFC_UP_ATTR_5,
145 DCB_PFC_UP_ATTR_6,
146 DCB_PFC_UP_ATTR_7,
147 DCB_PFC_UP_ATTR_ALL,
148
149 __DCB_PFC_UP_ATTR_ENUM_MAX,
150 DCB_PFC_UP_ATTR_MAX = __DCB_PFC_UP_ATTR_ENUM_MAX - 1,
151};
152
153/**
154 * enum dcbnl_pg_attrs - DCB Priority Group attributes
155 *
156 * @DCB_PG_ATTR_UNDEFINED: unspecified attribute to catch errors
157 * @DCB_PG_ATTR_TC_0: Priority Group Traffic Class 0 configuration (NLA_NESTED)
158 * @DCB_PG_ATTR_TC_1: Priority Group Traffic Class 1 configuration (NLA_NESTED)
159 * @DCB_PG_ATTR_TC_2: Priority Group Traffic Class 2 configuration (NLA_NESTED)
160 * @DCB_PG_ATTR_TC_3: Priority Group Traffic Class 3 configuration (NLA_NESTED)
161 * @DCB_PG_ATTR_TC_4: Priority Group Traffic Class 4 configuration (NLA_NESTED)
162 * @DCB_PG_ATTR_TC_5: Priority Group Traffic Class 5 configuration (NLA_NESTED)
163 * @DCB_PG_ATTR_TC_6: Priority Group Traffic Class 6 configuration (NLA_NESTED)
164 * @DCB_PG_ATTR_TC_7: Priority Group Traffic Class 7 configuration (NLA_NESTED)
165 * @DCB_PG_ATTR_TC_MAX: highest attribute number currently defined
166 * @DCB_PG_ATTR_TC_ALL: apply to all traffic classes (NLA_NESTED)
167 * @DCB_PG_ATTR_BW_ID_0: Percent of link bandwidth for Priority Group 0 (NLA_U8)
168 * @DCB_PG_ATTR_BW_ID_1: Percent of link bandwidth for Priority Group 1 (NLA_U8)
169 * @DCB_PG_ATTR_BW_ID_2: Percent of link bandwidth for Priority Group 2 (NLA_U8)
170 * @DCB_PG_ATTR_BW_ID_3: Percent of link bandwidth for Priority Group 3 (NLA_U8)
171 * @DCB_PG_ATTR_BW_ID_4: Percent of link bandwidth for Priority Group 4 (NLA_U8)
172 * @DCB_PG_ATTR_BW_ID_5: Percent of link bandwidth for Priority Group 5 (NLA_U8)
173 * @DCB_PG_ATTR_BW_ID_6: Percent of link bandwidth for Priority Group 6 (NLA_U8)
174 * @DCB_PG_ATTR_BW_ID_7: Percent of link bandwidth for Priority Group 7 (NLA_U8)
175 * @DCB_PG_ATTR_BW_ID_MAX: highest attribute number currently defined
176 * @DCB_PG_ATTR_BW_ID_ALL: apply to all priority groups (NLA_FLAG)
177 *
178 */
179enum dcbnl_pg_attrs {
180 DCB_PG_ATTR_UNDEFINED,
181
182 DCB_PG_ATTR_TC_0,
183 DCB_PG_ATTR_TC_1,
184 DCB_PG_ATTR_TC_2,
185 DCB_PG_ATTR_TC_3,
186 DCB_PG_ATTR_TC_4,
187 DCB_PG_ATTR_TC_5,
188 DCB_PG_ATTR_TC_6,
189 DCB_PG_ATTR_TC_7,
190 DCB_PG_ATTR_TC_MAX,
191 DCB_PG_ATTR_TC_ALL,
192
193 DCB_PG_ATTR_BW_ID_0,
194 DCB_PG_ATTR_BW_ID_1,
195 DCB_PG_ATTR_BW_ID_2,
196 DCB_PG_ATTR_BW_ID_3,
197 DCB_PG_ATTR_BW_ID_4,
198 DCB_PG_ATTR_BW_ID_5,
199 DCB_PG_ATTR_BW_ID_6,
200 DCB_PG_ATTR_BW_ID_7,
201 DCB_PG_ATTR_BW_ID_MAX,
202 DCB_PG_ATTR_BW_ID_ALL,
203
204 __DCB_PG_ATTR_ENUM_MAX,
205 DCB_PG_ATTR_MAX = __DCB_PG_ATTR_ENUM_MAX - 1,
206};
207
208/**
209 * enum dcbnl_tc_attrs - DCB Traffic Class attributes
210 *
211 * @DCB_TC_ATTR_PARAM_UNDEFINED: unspecified attribute to catch errors
212 * @DCB_TC_ATTR_PARAM_PGID: (NLA_U8) Priority group the traffic class belongs to
213 * Valid values are: 0-7
214 * @DCB_TC_ATTR_PARAM_UP_MAPPING: (NLA_U8) Traffic class to user priority map
215 * Some devices may not support changing the
216 * user priority map of a TC.
217 * @DCB_TC_ATTR_PARAM_STRICT_PRIO: (NLA_U8) Strict priority setting
218 * 0 - none
219 * 1 - group strict
220 * 2 - link strict
221 * @DCB_TC_ATTR_PARAM_BW_PCT: optional - (NLA_U8) If supported by the device and
222 * not configured to use link strict priority,
223 * this is the percentage of bandwidth of the
224 * priority group this traffic class belongs to
225 * @DCB_TC_ATTR_PARAM_ALL: (NLA_FLAG) all traffic class parameters
226 *
227 */
228enum dcbnl_tc_attrs {
229 DCB_TC_ATTR_PARAM_UNDEFINED,
230
231 DCB_TC_ATTR_PARAM_PGID,
232 DCB_TC_ATTR_PARAM_UP_MAPPING,
233 DCB_TC_ATTR_PARAM_STRICT_PRIO,
234 DCB_TC_ATTR_PARAM_BW_PCT,
235 DCB_TC_ATTR_PARAM_ALL,
236
237 __DCB_TC_ATTR_PARAM_ENUM_MAX,
238 DCB_TC_ATTR_PARAM_MAX = __DCB_TC_ATTR_PARAM_ENUM_MAX - 1,
239};
240
241/**
242 * enum dcbnl_cap_attrs - DCB Capability attributes
243 *
244 * @DCB_CAP_ATTR_UNDEFINED: unspecified attribute to catch errors
245 * @DCB_CAP_ATTR_ALL: (NLA_FLAG) all capability parameters
246 * @DCB_CAP_ATTR_PG: (NLA_U8) device supports Priority Groups
247 * @DCB_CAP_ATTR_PFC: (NLA_U8) device supports Priority Flow Control
248 * @DCB_CAP_ATTR_UP2TC: (NLA_U8) device supports user priority to
249 * traffic class mapping
250 * @DCB_CAP_ATTR_PG_TCS: (NLA_U8) bitmap where each bit represents a
251 * number of traffic classes the device
252 * can be configured to use for Priority Groups
253 * @DCB_CAP_ATTR_PFC_TCS: (NLA_U8) bitmap where each bit represents a
254 * number of traffic classes the device can be
255 * configured to use for Priority Flow Control
256 * @DCB_CAP_ATTR_GSP: (NLA_U8) device supports group strict priority
257 * @DCB_CAP_ATTR_BCN: (NLA_U8) device supports Backwards Congestion
258 * Notification
259 */
260enum dcbnl_cap_attrs {
261 DCB_CAP_ATTR_UNDEFINED,
262 DCB_CAP_ATTR_ALL,
263 DCB_CAP_ATTR_PG,
264 DCB_CAP_ATTR_PFC,
265 DCB_CAP_ATTR_UP2TC,
266 DCB_CAP_ATTR_PG_TCS,
267 DCB_CAP_ATTR_PFC_TCS,
268 DCB_CAP_ATTR_GSP,
269 DCB_CAP_ATTR_BCN,
270
271 __DCB_CAP_ATTR_ENUM_MAX,
272 DCB_CAP_ATTR_MAX = __DCB_CAP_ATTR_ENUM_MAX - 1,
273};
274
275/**
276 * enum dcbnl_numtcs_attrs - number of traffic classes
277 *
278 * @DCB_NUMTCS_ATTR_UNDEFINED: unspecified attribute to catch errors
279 * @DCB_NUMTCS_ATTR_ALL: (NLA_FLAG) all traffic class attributes
280 * @DCB_NUMTCS_ATTR_PG: (NLA_U8) number of traffic classes used for
281 * priority groups
282 * @DCB_NUMTCS_ATTR_PFC: (NLA_U8) number of traffic classes which can
283 * support priority flow control
284 */
285enum dcbnl_numtcs_attrs {
286 DCB_NUMTCS_ATTR_UNDEFINED,
287 DCB_NUMTCS_ATTR_ALL,
288 DCB_NUMTCS_ATTR_PG,
289 DCB_NUMTCS_ATTR_PFC,
290
291 __DCB_NUMTCS_ATTR_ENUM_MAX,
292 DCB_NUMTCS_ATTR_MAX = __DCB_NUMTCS_ATTR_ENUM_MAX - 1,
293};
294
295enum dcbnl_bcn_attrs{
296 DCB_BCN_ATTR_UNDEFINED = 0,
297
298 DCB_BCN_ATTR_RP_0,
299 DCB_BCN_ATTR_RP_1,
300 DCB_BCN_ATTR_RP_2,
301 DCB_BCN_ATTR_RP_3,
302 DCB_BCN_ATTR_RP_4,
303 DCB_BCN_ATTR_RP_5,
304 DCB_BCN_ATTR_RP_6,
305 DCB_BCN_ATTR_RP_7,
306 DCB_BCN_ATTR_RP_ALL,
307
308 DCB_BCN_ATTR_BCNA_0,
309 DCB_BCN_ATTR_BCNA_1,
310 DCB_BCN_ATTR_ALPHA,
311 DCB_BCN_ATTR_BETA,
312 DCB_BCN_ATTR_GD,
313 DCB_BCN_ATTR_GI,
314 DCB_BCN_ATTR_TMAX,
315 DCB_BCN_ATTR_TD,
316 DCB_BCN_ATTR_RMIN,
317 DCB_BCN_ATTR_W,
318 DCB_BCN_ATTR_RD,
319 DCB_BCN_ATTR_RU,
320 DCB_BCN_ATTR_WRTT,
321 DCB_BCN_ATTR_RI,
322 DCB_BCN_ATTR_C,
323 DCB_BCN_ATTR_ALL,
324
325 __DCB_BCN_ATTR_ENUM_MAX,
326 DCB_BCN_ATTR_MAX = __DCB_BCN_ATTR_ENUM_MAX - 1,
327};
328
329/**
330 * enum dcb_general_attr_values - general DCB attribute values
331 *
332 * @DCB_ATTR_UNDEFINED: value used to indicate an attribute is not supported
333 *
334 */
335enum dcb_general_attr_values {
336 DCB_ATTR_VALUE_UNDEFINED = 0xff
337};
338
339
340#endif /* __LINUX_DCBNL_H__ */
diff --git a/include/linux/dccp.h b/include/linux/dccp.h
index 6080449fbec..61734e27abb 100644
--- a/include/linux/dccp.h
+++ b/include/linux/dccp.h
@@ -168,6 +168,8 @@ enum {
168 DCCPO_MIN_CCID_SPECIFIC = 128, 168 DCCPO_MIN_CCID_SPECIFIC = 128,
169 DCCPO_MAX_CCID_SPECIFIC = 255, 169 DCCPO_MAX_CCID_SPECIFIC = 255,
170}; 170};
171/* maximum size of a single TLV-encoded DCCP option (sans type/len bytes) */
172#define DCCP_SINGLE_OPT_MAXLEN 253
171 173
172/* DCCP CCIDS */ 174/* DCCP CCIDS */
173enum { 175enum {
@@ -176,29 +178,23 @@ enum {
176}; 178};
177 179
178/* DCCP features (RFC 4340 section 6.4) */ 180/* DCCP features (RFC 4340 section 6.4) */
179enum { 181enum dccp_feature_numbers {
180 DCCPF_RESERVED = 0, 182 DCCPF_RESERVED = 0,
181 DCCPF_CCID = 1, 183 DCCPF_CCID = 1,
182 DCCPF_SHORT_SEQNOS = 2, /* XXX: not yet implemented */ 184 DCCPF_SHORT_SEQNOS = 2,
183 DCCPF_SEQUENCE_WINDOW = 3, 185 DCCPF_SEQUENCE_WINDOW = 3,
184 DCCPF_ECN_INCAPABLE = 4, /* XXX: not yet implemented */ 186 DCCPF_ECN_INCAPABLE = 4,
185 DCCPF_ACK_RATIO = 5, 187 DCCPF_ACK_RATIO = 5,
186 DCCPF_SEND_ACK_VECTOR = 6, 188 DCCPF_SEND_ACK_VECTOR = 6,
187 DCCPF_SEND_NDP_COUNT = 7, 189 DCCPF_SEND_NDP_COUNT = 7,
188 DCCPF_MIN_CSUM_COVER = 8, 190 DCCPF_MIN_CSUM_COVER = 8,
189 DCCPF_DATA_CHECKSUM = 9, /* XXX: not yet implemented */ 191 DCCPF_DATA_CHECKSUM = 9,
190 /* 10-127 reserved */ 192 /* 10-127 reserved */
191 DCCPF_MIN_CCID_SPECIFIC = 128, 193 DCCPF_MIN_CCID_SPECIFIC = 128,
194 DCCPF_SEND_LEV_RATE = 192, /* RFC 4342, sec. 8.4 */
192 DCCPF_MAX_CCID_SPECIFIC = 255, 195 DCCPF_MAX_CCID_SPECIFIC = 255,
193}; 196};
194 197
195/* this structure is argument to DCCP_SOCKOPT_CHANGE_X */
196struct dccp_so_feat {
197 __u8 dccpsf_feat;
198 __u8 __user *dccpsf_val;
199 __u8 dccpsf_len;
200};
201
202/* DCCP socket options */ 198/* DCCP socket options */
203#define DCCP_SOCKOPT_PACKET_SIZE 1 /* XXX deprecated, without effect */ 199#define DCCP_SOCKOPT_PACKET_SIZE 1 /* XXX deprecated, without effect */
204#define DCCP_SOCKOPT_SERVICE 2 200#define DCCP_SOCKOPT_SERVICE 2
@@ -208,6 +204,10 @@ struct dccp_so_feat {
208#define DCCP_SOCKOPT_SERVER_TIMEWAIT 6 204#define DCCP_SOCKOPT_SERVER_TIMEWAIT 6
209#define DCCP_SOCKOPT_SEND_CSCOV 10 205#define DCCP_SOCKOPT_SEND_CSCOV 10
210#define DCCP_SOCKOPT_RECV_CSCOV 11 206#define DCCP_SOCKOPT_RECV_CSCOV 11
207#define DCCP_SOCKOPT_AVAILABLE_CCIDS 12
208#define DCCP_SOCKOPT_CCID 13
209#define DCCP_SOCKOPT_TX_CCID 14
210#define DCCP_SOCKOPT_RX_CCID 15
211#define DCCP_SOCKOPT_CCID_RX_INFO 128 211#define DCCP_SOCKOPT_CCID_RX_INFO 128
212#define DCCP_SOCKOPT_CCID_TX_INFO 192 212#define DCCP_SOCKOPT_CCID_TX_INFO 192
213 213
@@ -360,7 +360,6 @@ static inline unsigned int dccp_hdr_len(const struct sk_buff *skb)
360#define DCCPF_INITIAL_SEQUENCE_WINDOW 100 360#define DCCPF_INITIAL_SEQUENCE_WINDOW 100
361#define DCCPF_INITIAL_ACK_RATIO 2 361#define DCCPF_INITIAL_ACK_RATIO 2
362#define DCCPF_INITIAL_CCID DCCPC_CCID2 362#define DCCPF_INITIAL_CCID DCCPC_CCID2
363#define DCCPF_INITIAL_SEND_ACK_VECTOR 1
364/* FIXME: for now we're default to 1 but it should really be 0 */ 363/* FIXME: for now we're default to 1 but it should really be 0 */
365#define DCCPF_INITIAL_SEND_NDP_COUNT 1 364#define DCCPF_INITIAL_SEND_NDP_COUNT 1
366 365
@@ -370,20 +369,11 @@ static inline unsigned int dccp_hdr_len(const struct sk_buff *skb)
370 * Will be used to pass the state from dccp_request_sock to dccp_sock. 369 * Will be used to pass the state from dccp_request_sock to dccp_sock.
371 * 370 *
372 * @dccpms_sequence_window - Sequence Window Feature (section 7.5.2) 371 * @dccpms_sequence_window - Sequence Window Feature (section 7.5.2)
373 * @dccpms_ccid - Congestion Control Id (CCID) (section 10)
374 * @dccpms_send_ack_vector - Send Ack Vector Feature (section 11.5)
375 * @dccpms_send_ndp_count - Send NDP Count Feature (7.7.2)
376 * @dccpms_ack_ratio - Ack Ratio Feature (section 11.3)
377 * @dccpms_pending - List of features being negotiated 372 * @dccpms_pending - List of features being negotiated
378 * @dccpms_conf - 373 * @dccpms_conf -
379 */ 374 */
380struct dccp_minisock { 375struct dccp_minisock {
381 __u64 dccpms_sequence_window; 376 __u64 dccpms_sequence_window;
382 __u8 dccpms_rx_ccid;
383 __u8 dccpms_tx_ccid;
384 __u8 dccpms_send_ack_vector;
385 __u8 dccpms_send_ndp_count;
386 __u8 dccpms_ack_ratio;
387 struct list_head dccpms_pending; 377 struct list_head dccpms_pending;
388 struct list_head dccpms_conf; 378 struct list_head dccpms_conf;
389}; 379};
@@ -411,6 +401,7 @@ extern void dccp_minisock_init(struct dccp_minisock *dmsk);
411 * @dreq_iss: initial sequence number sent on the Response (RFC 4340, 7.1) 401 * @dreq_iss: initial sequence number sent on the Response (RFC 4340, 7.1)
412 * @dreq_isr: initial sequence number received on the Request 402 * @dreq_isr: initial sequence number received on the Request
413 * @dreq_service: service code present on the Request (there is just one) 403 * @dreq_service: service code present on the Request (there is just one)
404 * @dreq_featneg: feature negotiation options for this connection
414 * The following two fields are analogous to the ones in dccp_sock: 405 * The following two fields are analogous to the ones in dccp_sock:
415 * @dreq_timestamp_echo: last received timestamp to echo (13.1) 406 * @dreq_timestamp_echo: last received timestamp to echo (13.1)
416 * @dreq_timestamp_echo: the time of receiving the last @dreq_timestamp_echo 407 * @dreq_timestamp_echo: the time of receiving the last @dreq_timestamp_echo
@@ -420,6 +411,7 @@ struct dccp_request_sock {
420 __u64 dreq_iss; 411 __u64 dreq_iss;
421 __u64 dreq_isr; 412 __u64 dreq_isr;
422 __be32 dreq_service; 413 __be32 dreq_service;
414 struct list_head dreq_featneg;
423 __u32 dreq_timestamp_echo; 415 __u32 dreq_timestamp_echo;
424 __u32 dreq_timestamp_time; 416 __u32 dreq_timestamp_time;
425}; 417};
@@ -493,10 +485,12 @@ struct dccp_ackvec;
493 * @dccps_r_ack_ratio - feature-remote Ack Ratio 485 * @dccps_r_ack_ratio - feature-remote Ack Ratio
494 * @dccps_pcslen - sender partial checksum coverage (via sockopt) 486 * @dccps_pcslen - sender partial checksum coverage (via sockopt)
495 * @dccps_pcrlen - receiver partial checksum coverage (via sockopt) 487 * @dccps_pcrlen - receiver partial checksum coverage (via sockopt)
488 * @dccps_send_ndp_count - local Send NDP Count feature (7.7.2)
496 * @dccps_ndp_count - number of Non Data Packets since last data packet 489 * @dccps_ndp_count - number of Non Data Packets since last data packet
497 * @dccps_mss_cache - current value of MSS (path MTU minus header sizes) 490 * @dccps_mss_cache - current value of MSS (path MTU minus header sizes)
498 * @dccps_rate_last - timestamp for rate-limiting DCCP-Sync (RFC 4340, 7.5.4) 491 * @dccps_rate_last - timestamp for rate-limiting DCCP-Sync (RFC 4340, 7.5.4)
499 * @dccps_minisock - associated minisock (accessed via dccp_msk) 492 * @dccps_minisock - associated minisock (accessed via dccp_msk)
493 * @dccps_featneg - tracks feature-negotiation state (mostly during handshake)
500 * @dccps_hc_rx_ackvec - rx half connection ack vector 494 * @dccps_hc_rx_ackvec - rx half connection ack vector
501 * @dccps_hc_rx_ccid - CCID used for the receiver (or receiving half-connection) 495 * @dccps_hc_rx_ccid - CCID used for the receiver (or receiving half-connection)
502 * @dccps_hc_tx_ccid - CCID used for the sender (or sending half-connection) 496 * @dccps_hc_tx_ccid - CCID used for the sender (or sending half-connection)
@@ -529,11 +523,13 @@ struct dccp_sock {
529 __u32 dccps_timestamp_time; 523 __u32 dccps_timestamp_time;
530 __u16 dccps_l_ack_ratio; 524 __u16 dccps_l_ack_ratio;
531 __u16 dccps_r_ack_ratio; 525 __u16 dccps_r_ack_ratio;
532 __u16 dccps_pcslen; 526 __u8 dccps_pcslen:4;
533 __u16 dccps_pcrlen; 527 __u8 dccps_pcrlen:4;
528 __u8 dccps_send_ndp_count:1;
534 __u64 dccps_ndp_count:48; 529 __u64 dccps_ndp_count:48;
535 unsigned long dccps_rate_last; 530 unsigned long dccps_rate_last;
536 struct dccp_minisock dccps_minisock; 531 struct dccp_minisock dccps_minisock;
532 struct list_head dccps_featneg;
537 struct dccp_ackvec *dccps_hc_rx_ackvec; 533 struct dccp_ackvec *dccps_hc_rx_ackvec;
538 struct ccid *dccps_hc_rx_ccid; 534 struct ccid *dccps_hc_rx_ccid;
539 struct ccid *dccps_hc_tx_ccid; 535 struct ccid *dccps_hc_tx_ccid;
diff --git a/include/linux/dmi.h b/include/linux/dmi.h
index e5084eb5943..34161907b2f 100644
--- a/include/linux/dmi.h
+++ b/include/linux/dmi.h
@@ -44,8 +44,10 @@ extern const struct dmi_device * dmi_find_device(int type, const char *name,
44extern void dmi_scan_machine(void); 44extern void dmi_scan_machine(void);
45extern int dmi_get_year(int field); 45extern int dmi_get_year(int field);
46extern int dmi_name_in_vendors(const char *str); 46extern int dmi_name_in_vendors(const char *str);
47extern int dmi_name_in_serial(const char *str);
47extern int dmi_available; 48extern int dmi_available;
48extern int dmi_walk(void (*decode)(const struct dmi_header *)); 49extern int dmi_walk(void (*decode)(const struct dmi_header *));
50extern bool dmi_match(enum dmi_field f, const char *str);
49 51
50#else 52#else
51 53
@@ -56,9 +58,12 @@ static inline const struct dmi_device * dmi_find_device(int type, const char *na
56static inline void dmi_scan_machine(void) { return; } 58static inline void dmi_scan_machine(void) { return; }
57static inline int dmi_get_year(int year) { return 0; } 59static inline int dmi_get_year(int year) { return 0; }
58static inline int dmi_name_in_vendors(const char *s) { return 0; } 60static inline int dmi_name_in_vendors(const char *s) { return 0; }
61static inline int dmi_name_in_serial(const char *s) { return 0; }
59#define dmi_available 0 62#define dmi_available 0
60static inline int dmi_walk(void (*decode)(const struct dmi_header *)) 63static inline int dmi_walk(void (*decode)(const struct dmi_header *))
61 { return -1; } 64 { return -1; }
65static inline bool dmi_match(enum dmi_field f, const char *str)
66 { return false; }
62 67
63#endif 68#endif
64 69
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index 92f6f634e3e..7a204256b15 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -28,7 +28,7 @@ typedef void (elevator_activate_req_fn) (struct request_queue *, struct request
28typedef void (elevator_deactivate_req_fn) (struct request_queue *, struct request *); 28typedef void (elevator_deactivate_req_fn) (struct request_queue *, struct request *);
29 29
30typedef void *(elevator_init_fn) (struct request_queue *); 30typedef void *(elevator_init_fn) (struct request_queue *);
31typedef void (elevator_exit_fn) (elevator_t *); 31typedef void (elevator_exit_fn) (struct elevator_queue *);
32 32
33struct elevator_ops 33struct elevator_ops
34{ 34{
@@ -62,8 +62,8 @@ struct elevator_ops
62 62
63struct elv_fs_entry { 63struct elv_fs_entry {
64 struct attribute attr; 64 struct attribute attr;
65 ssize_t (*show)(elevator_t *, char *); 65 ssize_t (*show)(struct elevator_queue *, char *);
66 ssize_t (*store)(elevator_t *, const char *, size_t); 66 ssize_t (*store)(struct elevator_queue *, const char *, size_t);
67}; 67};
68 68
69/* 69/*
@@ -130,7 +130,7 @@ extern ssize_t elv_iosched_show(struct request_queue *, char *);
130extern ssize_t elv_iosched_store(struct request_queue *, const char *, size_t); 130extern ssize_t elv_iosched_store(struct request_queue *, const char *, size_t);
131 131
132extern int elevator_init(struct request_queue *, char *); 132extern int elevator_init(struct request_queue *, char *);
133extern void elevator_exit(elevator_t *); 133extern void elevator_exit(struct elevator_queue *);
134extern int elv_rq_merge_ok(struct request *, struct bio *); 134extern int elv_rq_merge_ok(struct request *, struct bio *);
135 135
136/* 136/*
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index 25d62e6e329..1cb0f0b9092 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -27,6 +27,7 @@
27#include <linux/if_ether.h> 27#include <linux/if_ether.h>
28#include <linux/netdevice.h> 28#include <linux/netdevice.h>
29#include <linux/random.h> 29#include <linux/random.h>
30#include <asm/unaligned.h>
30 31
31#ifdef __KERNEL__ 32#ifdef __KERNEL__
32extern __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev); 33extern __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev);
@@ -41,6 +42,10 @@ extern int eth_header_cache(const struct neighbour *neigh, struct hh_cache *hh);
41extern void eth_header_cache_update(struct hh_cache *hh, 42extern void eth_header_cache_update(struct hh_cache *hh,
42 const struct net_device *dev, 43 const struct net_device *dev,
43 const unsigned char *haddr); 44 const unsigned char *haddr);
45extern int eth_mac_addr(struct net_device *dev, void *p);
46extern int eth_change_mtu(struct net_device *dev, int new_mtu);
47extern int eth_validate_addr(struct net_device *dev);
48
44 49
45 50
46extern struct net_device *alloc_etherdev_mq(int sizeof_priv, unsigned int queue_count); 51extern struct net_device *alloc_etherdev_mq(int sizeof_priv, unsigned int queue_count);
@@ -136,6 +141,47 @@ static inline unsigned compare_ether_addr(const u8 *addr1, const u8 *addr2)
136 BUILD_BUG_ON(ETH_ALEN != 6); 141 BUILD_BUG_ON(ETH_ALEN != 6);
137 return ((a[0] ^ b[0]) | (a[1] ^ b[1]) | (a[2] ^ b[2])) != 0; 142 return ((a[0] ^ b[0]) | (a[1] ^ b[1]) | (a[2] ^ b[2])) != 0;
138} 143}
144
145static inline unsigned long zap_last_2bytes(unsigned long value)
146{
147#ifdef __BIG_ENDIAN
148 return value >> 16;
149#else
150 return value << 16;
151#endif
152}
153
154/**
155 * compare_ether_addr_64bits - Compare two Ethernet addresses
156 * @addr1: Pointer to an array of 8 bytes
157 * @addr2: Pointer to an other array of 8 bytes
158 *
159 * Compare two ethernet addresses, returns 0 if equal.
160 * Same result than "memcmp(addr1, addr2, ETH_ALEN)" but without conditional
161 * branches, and possibly long word memory accesses on CPU allowing cheap
162 * unaligned memory reads.
163 * arrays = { byte1, byte2, byte3, byte4, byte6, byte7, pad1, pad2}
164 *
165 * Please note that alignment of addr1 & addr2 is only guaranted to be 16 bits.
166 */
167
168static inline unsigned compare_ether_addr_64bits(const u8 addr1[6+2],
169 const u8 addr2[6+2])
170{
171#ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
172 unsigned long fold = ((*(unsigned long *)addr1) ^
173 (*(unsigned long *)addr2));
174
175 if (sizeof(fold) == 8)
176 return zap_last_2bytes(fold) != 0;
177
178 fold |= zap_last_2bytes((*(unsigned long *)(addr1 + 4)) ^
179 (*(unsigned long *)(addr2 + 4)));
180 return fold != 0;
181#else
182 return compare_ether_addr(addr1, addr2);
183#endif
184}
139#endif /* __KERNEL__ */ 185#endif /* __KERNEL__ */
140 186
141#endif /* _LINUX_ETHERDEVICE_H */ 187#endif /* _LINUX_ETHERDEVICE_H */
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index b4b038b89ee..27c67a54223 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -467,6 +467,8 @@ struct ethtool_ops {
467 467
468#define ETHTOOL_GRXFH 0x00000029 /* Get RX flow hash configuration */ 468#define ETHTOOL_GRXFH 0x00000029 /* Get RX flow hash configuration */
469#define ETHTOOL_SRXFH 0x0000002a /* Set RX flow hash configuration */ 469#define ETHTOOL_SRXFH 0x0000002a /* Set RX flow hash configuration */
470#define ETHTOOL_GGRO 0x0000002b /* Get GRO enable (ethtool_value) */
471#define ETHTOOL_SGRO 0x0000002c /* Set GRO enable (ethtool_value) */
470 472
471/* compatibility with older code */ 473/* compatibility with older code */
472#define SPARC_ETH_GSET ETHTOOL_GSET 474#define SPARC_ETH_GSET ETHTOOL_GSET
diff --git a/include/linux/fault-inject.h b/include/linux/fault-inject.h
index 32368c4f032..06ca9b21dad 100644
--- a/include/linux/fault-inject.h
+++ b/include/linux/fault-inject.h
@@ -81,4 +81,13 @@ static inline void cleanup_fault_attr_dentries(struct fault_attr *attr)
81 81
82#endif /* CONFIG_FAULT_INJECTION */ 82#endif /* CONFIG_FAULT_INJECTION */
83 83
84#ifdef CONFIG_FAILSLAB
85extern bool should_failslab(size_t size, gfp_t gfpflags);
86#else
87static inline bool should_failslab(size_t size, gfp_t gfpflags)
88{
89 return false;
90}
91#endif /* CONFIG_FAILSLAB */
92
84#endif /* _LINUX_FAULT_INJECT_H */ 93#endif /* _LINUX_FAULT_INJECT_H */
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 75a81eaf343..1ee63df5be9 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -888,7 +888,7 @@ struct fb_info {
888#define fb_writeq sbus_writeq 888#define fb_writeq sbus_writeq
889#define fb_memset sbus_memset_io 889#define fb_memset sbus_memset_io
890 890
891#elif defined(__i386__) || defined(__alpha__) || defined(__x86_64__) || defined(__hppa__) || (defined(__sh__) && !defined(__SH5__)) || defined(__powerpc__) || defined(__avr32__) 891#elif defined(__i386__) || defined(__alpha__) || defined(__x86_64__) || defined(__hppa__) || defined(__sh__) || defined(__powerpc__) || defined(__avr32__)
892 892
893#define fb_readb __raw_readb 893#define fb_readb __raw_readb
894#define fb_readw __raw_readw 894#define fb_readw __raw_readw
diff --git a/include/linux/fddidevice.h b/include/linux/fddidevice.h
index e61e42dfd31..155bafd9e88 100644
--- a/include/linux/fddidevice.h
+++ b/include/linux/fddidevice.h
@@ -27,6 +27,7 @@
27#ifdef __KERNEL__ 27#ifdef __KERNEL__
28extern __be16 fddi_type_trans(struct sk_buff *skb, 28extern __be16 fddi_type_trans(struct sk_buff *skb,
29 struct net_device *dev); 29 struct net_device *dev);
30extern int fddi_change_mtu(struct net_device *dev, int new_mtu);
30extern struct net_device *alloc_fddidev(int sizeof_priv); 31extern struct net_device *alloc_fddidev(int sizeof_priv);
31#endif 32#endif
32 33
diff --git a/include/linux/filter.h b/include/linux/filter.h
index b6ea9aa9e85..1354aaf6abb 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -122,7 +122,8 @@ struct sock_fprog /* Required for SO_ATTACH_FILTER. */
122#define SKF_AD_PKTTYPE 4 122#define SKF_AD_PKTTYPE 4
123#define SKF_AD_IFINDEX 8 123#define SKF_AD_IFINDEX 8
124#define SKF_AD_NLATTR 12 124#define SKF_AD_NLATTR 12
125#define SKF_AD_MAX 16 125#define SKF_AD_NLATTR_NEST 16
126#define SKF_AD_MAX 20
126#define SKF_NET_OFF (-0x100000) 127#define SKF_NET_OFF (-0x100000)
127#define SKF_LL_OFF (-0x200000) 128#define SKF_LL_OFF (-0x200000)
128 129
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 4a853ef6fd3..001ded4845b 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -82,6 +82,14 @@ extern int dir_notify_enable;
82 (specialy hack for floppy.c) */ 82 (specialy hack for floppy.c) */
83#define FMODE_WRITE_IOCTL ((__force fmode_t)128) 83#define FMODE_WRITE_IOCTL ((__force fmode_t)128)
84 84
85/*
86 * Don't update ctime and mtime.
87 *
88 * Currently a special hack for the XFS open_by_handle ioctl, but we'll
89 * hopefully graduate it to a proper O_CMTIME flag supported by open(2) soon.
90 */
91#define FMODE_NOCMTIME ((__force fmode_t)2048)
92
85#define RW_MASK 1 93#define RW_MASK 1
86#define RWA_MASK 2 94#define RWA_MASK 2
87#define READ 0 95#define READ 0
@@ -316,6 +324,7 @@ struct poll_table_struct;
316struct kstatfs; 324struct kstatfs;
317struct vm_area_struct; 325struct vm_area_struct;
318struct vfsmount; 326struct vfsmount;
327struct cred;
319 328
320extern void __init inode_init(void); 329extern void __init inode_init(void);
321extern void __init inode_init_early(void); 330extern void __init inode_init_early(void);
@@ -827,7 +836,7 @@ struct file {
827 fmode_t f_mode; 836 fmode_t f_mode;
828 loff_t f_pos; 837 loff_t f_pos;
829 struct fown_struct f_owner; 838 struct fown_struct f_owner;
830 unsigned int f_uid, f_gid; 839 const struct cred *f_cred;
831 struct file_ra_state f_ra; 840 struct file_ra_state f_ra;
832 841
833 u64 f_version; 842 u64 f_version;
@@ -1194,7 +1203,7 @@ enum {
1194#define has_fs_excl() atomic_read(&current->fs_excl) 1203#define has_fs_excl() atomic_read(&current->fs_excl)
1195 1204
1196#define is_owner_or_cap(inode) \ 1205#define is_owner_or_cap(inode) \
1197 ((current->fsuid == (inode)->i_uid) || capable(CAP_FOWNER)) 1206 ((current_fsuid() == (inode)->i_uid) || capable(CAP_FOWNER))
1198 1207
1199/* not quite ready to be deprecated, but... */ 1208/* not quite ready to be deprecated, but... */
1200extern void lock_super(struct super_block *); 1209extern void lock_super(struct super_block *);
@@ -1674,7 +1683,8 @@ extern int do_truncate(struct dentry *, loff_t start, unsigned int time_attrs,
1674extern long do_sys_open(int dfd, const char __user *filename, int flags, 1683extern long do_sys_open(int dfd, const char __user *filename, int flags,
1675 int mode); 1684 int mode);
1676extern struct file *filp_open(const char *, int, int); 1685extern struct file *filp_open(const char *, int, int);
1677extern struct file * dentry_open(struct dentry *, struct vfsmount *, int); 1686extern struct file * dentry_open(struct dentry *, struct vfsmount *, int,
1687 const struct cred *);
1678extern int filp_close(struct file *, fl_owner_t id); 1688extern int filp_close(struct file *, fl_owner_t id);
1679extern char * getname(const char __user *); 1689extern char * getname(const char __user *);
1680 1690
@@ -1875,7 +1885,9 @@ extern loff_t default_llseek(struct file *file, loff_t offset, int origin);
1875 1885
1876extern loff_t vfs_llseek(struct file *file, loff_t offset, int origin); 1886extern loff_t vfs_llseek(struct file *file, loff_t offset, int origin);
1877 1887
1888extern struct inode * inode_init_always(struct super_block *, struct inode *);
1878extern void inode_init_once(struct inode *); 1889extern void inode_init_once(struct inode *);
1890extern void inode_add_to_lists(struct super_block *, struct inode *);
1879extern void iput(struct inode *); 1891extern void iput(struct inode *);
1880extern struct inode * igrab(struct inode *); 1892extern struct inode * igrab(struct inode *);
1881extern ino_t iunique(struct super_block *, ino_t); 1893extern ino_t iunique(struct super_block *, ino_t);
diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h
index 708bab58d8d..d9051d717d2 100644
--- a/include/linux/fsl_devices.h
+++ b/include/linux/fsl_devices.h
@@ -47,12 +47,7 @@
47struct gianfar_platform_data { 47struct gianfar_platform_data {
48 /* device specific information */ 48 /* device specific information */
49 u32 device_flags; 49 u32 device_flags;
50 /* board specific information */ 50 char bus_id[BUS_ID_SIZE];
51 u32 board_flags;
52 int mdio_bus; /* Bus controlled by us */
53 char bus_id[MII_BUS_ID_SIZE]; /* Bus PHY is on */
54 u32 phy_id;
55 u8 mac_addr[6];
56 phy_interface_t interface; 51 phy_interface_t interface;
57}; 52};
58 53
@@ -61,17 +56,6 @@ struct gianfar_mdio_data {
61 int irq[32]; 56 int irq[32];
62}; 57};
63 58
64/* Flags related to gianfar device features */
65#define FSL_GIANFAR_DEV_HAS_GIGABIT 0x00000001
66#define FSL_GIANFAR_DEV_HAS_COALESCE 0x00000002
67#define FSL_GIANFAR_DEV_HAS_RMON 0x00000004
68#define FSL_GIANFAR_DEV_HAS_MULTI_INTR 0x00000008
69#define FSL_GIANFAR_DEV_HAS_CSUM 0x00000010
70#define FSL_GIANFAR_DEV_HAS_VLAN 0x00000020
71#define FSL_GIANFAR_DEV_HAS_EXTENDED_HASH 0x00000040
72#define FSL_GIANFAR_DEV_HAS_PADDING 0x00000080
73#define FSL_GIANFAR_DEV_HAS_MAGIC_PACKET 0x00000100
74
75/* Flags in gianfar_platform_data */ 59/* Flags in gianfar_platform_data */
76#define FSL_GIANFAR_BRD_HAS_PHY_INTR 0x00000001 /* set or use a timer */ 60#define FSL_GIANFAR_BRD_HAS_PHY_INTR 0x00000001 /* set or use a timer */
77#define FSL_GIANFAR_BRD_IS_REDUCED 0x00000002 /* Set if RGMII, RMII */ 61#define FSL_GIANFAR_BRD_IS_REDUCED 0x00000002 /* Set if RGMII, RMII */
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 985b28dc2ba..677432b9cb7 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -87,6 +87,14 @@ static inline void ftrace_stop(void) { }
87static inline void ftrace_start(void) { } 87static inline void ftrace_start(void) { }
88#endif /* CONFIG_FUNCTION_TRACER */ 88#endif /* CONFIG_FUNCTION_TRACER */
89 89
90#ifdef CONFIG_STACK_TRACER
91extern int stack_tracer_enabled;
92int
93stack_trace_sysctl(struct ctl_table *table, int write,
94 struct file *file, void __user *buffer, size_t *lenp,
95 loff_t *ppos);
96#endif
97
90#ifdef CONFIG_DYNAMIC_FTRACE 98#ifdef CONFIG_DYNAMIC_FTRACE
91/* asm/ftrace.h must be defined for archs supporting dynamic ftrace */ 99/* asm/ftrace.h must be defined for archs supporting dynamic ftrace */
92#include <asm/ftrace.h> 100#include <asm/ftrace.h>
@@ -295,7 +303,7 @@ extern void ftrace_dump(void);
295static inline void 303static inline void
296ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3) { } 304ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3) { }
297static inline int 305static inline int
298ftrace_printk(const char *fmt, ...) __attribute__ ((format (printf, 1, 0))); 306ftrace_printk(const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
299 307
300static inline void tracing_start(void) { } 308static inline void tracing_start(void) { }
301static inline void tracing_stop(void) { } 309static inline void tracing_stop(void) { }
@@ -378,6 +386,16 @@ struct ftrace_graph_ret {
378 */ 386 */
379#define __notrace_funcgraph notrace 387#define __notrace_funcgraph notrace
380 388
389/*
390 * We want to which function is an entrypoint of a hardirq.
391 * That will help us to put a signal on output.
392 */
393#define __irq_entry __attribute__((__section__(".irqentry.text")))
394
395/* Limits of hardirq entrypoints */
396extern char __irqentry_text_start[];
397extern char __irqentry_text_end[];
398
381#define FTRACE_RETFUNC_DEPTH 50 399#define FTRACE_RETFUNC_DEPTH 50
382#define FTRACE_RETSTACK_ALLOC_SIZE 32 400#define FTRACE_RETSTACK_ALLOC_SIZE 32
383/* Type of the callback handlers for tracing function graph*/ 401/* Type of the callback handlers for tracing function graph*/
@@ -415,6 +433,7 @@ static inline void unpause_graph_tracing(void)
415#else 433#else
416 434
417#define __notrace_funcgraph 435#define __notrace_funcgraph
436#define __irq_entry
418 437
419static inline void ftrace_graph_init_task(struct task_struct *t) { } 438static inline void ftrace_graph_init_task(struct task_struct *t) { }
420static inline void ftrace_graph_exit_task(struct task_struct *t) { } 439static inline void ftrace_graph_exit_task(struct task_struct *t) { }
diff --git a/include/linux/futex.h b/include/linux/futex.h
index 8f627b9ae2b..3bf5bb5a34f 100644
--- a/include/linux/futex.h
+++ b/include/linux/futex.h
@@ -25,7 +25,8 @@ union ktime;
25#define FUTEX_WAKE_BITSET 10 25#define FUTEX_WAKE_BITSET 10
26 26
27#define FUTEX_PRIVATE_FLAG 128 27#define FUTEX_PRIVATE_FLAG 128
28#define FUTEX_CMD_MASK ~FUTEX_PRIVATE_FLAG 28#define FUTEX_CLOCK_REALTIME 256
29#define FUTEX_CMD_MASK ~(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME)
29 30
30#define FUTEX_WAIT_PRIVATE (FUTEX_WAIT | FUTEX_PRIVATE_FLAG) 31#define FUTEX_WAIT_PRIVATE (FUTEX_WAIT | FUTEX_PRIVATE_FLAG)
31#define FUTEX_WAKE_PRIVATE (FUTEX_WAKE | FUTEX_PRIVATE_FLAG) 32#define FUTEX_WAKE_PRIVATE (FUTEX_WAKE | FUTEX_PRIVATE_FLAG)
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 3df7742ce24..16948eaecae 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -126,6 +126,7 @@ struct blk_scsi_cmd_filter {
126struct disk_part_tbl { 126struct disk_part_tbl {
127 struct rcu_head rcu_head; 127 struct rcu_head rcu_head;
128 int len; 128 int len;
129 struct hd_struct *last_lookup;
129 struct hd_struct *part[]; 130 struct hd_struct *part[];
130}; 131};
131 132
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h
index 89a56d79e4c..f83288347dd 100644
--- a/include/linux/hardirq.h
+++ b/include/linux/hardirq.h
@@ -119,13 +119,17 @@ static inline void account_system_vtime(struct task_struct *tsk)
119} 119}
120#endif 120#endif
121 121
122#if defined(CONFIG_PREEMPT_RCU) && defined(CONFIG_NO_HZ) 122#if defined(CONFIG_NO_HZ) && !defined(CONFIG_CLASSIC_RCU)
123extern void rcu_irq_enter(void); 123extern void rcu_irq_enter(void);
124extern void rcu_irq_exit(void); 124extern void rcu_irq_exit(void);
125extern void rcu_nmi_enter(void);
126extern void rcu_nmi_exit(void);
125#else 127#else
126# define rcu_irq_enter() do { } while (0) 128# define rcu_irq_enter() do { } while (0)
127# define rcu_irq_exit() do { } while (0) 129# define rcu_irq_exit() do { } while (0)
128#endif /* CONFIG_PREEMPT_RCU */ 130# define rcu_nmi_enter() do { } while (0)
131# define rcu_nmi_exit() do { } while (0)
132#endif /* #if defined(CONFIG_NO_HZ) && !defined(CONFIG_CLASSIC_RCU) */
129 133
130/* 134/*
131 * It is safe to do non-atomic ops on ->hardirq_context, 135 * It is safe to do non-atomic ops on ->hardirq_context,
@@ -135,7 +139,6 @@ extern void rcu_irq_exit(void);
135 */ 139 */
136#define __irq_enter() \ 140#define __irq_enter() \
137 do { \ 141 do { \
138 rcu_irq_enter(); \
139 account_system_vtime(current); \ 142 account_system_vtime(current); \
140 add_preempt_count(HARDIRQ_OFFSET); \ 143 add_preempt_count(HARDIRQ_OFFSET); \
141 trace_hardirq_enter(); \ 144 trace_hardirq_enter(); \
@@ -154,7 +157,6 @@ extern void irq_enter(void);
154 trace_hardirq_exit(); \ 157 trace_hardirq_exit(); \
155 account_system_vtime(current); \ 158 account_system_vtime(current); \
156 sub_preempt_count(HARDIRQ_OFFSET); \ 159 sub_preempt_count(HARDIRQ_OFFSET); \
157 rcu_irq_exit(); \
158 } while (0) 160 } while (0)
159 161
160/* 162/*
@@ -166,11 +168,14 @@ extern void irq_exit(void);
166 do { \ 168 do { \
167 ftrace_nmi_enter(); \ 169 ftrace_nmi_enter(); \
168 lockdep_off(); \ 170 lockdep_off(); \
171 rcu_nmi_enter(); \
169 __irq_enter(); \ 172 __irq_enter(); \
170 } while (0) 173 } while (0)
174
171#define nmi_exit() \ 175#define nmi_exit() \
172 do { \ 176 do { \
173 __irq_exit(); \ 177 __irq_exit(); \
178 rcu_nmi_exit(); \
174 lockdep_on(); \ 179 lockdep_on(); \
175 ftrace_nmi_exit(); \ 180 ftrace_nmi_exit(); \
176 } while (0) 181 } while (0)
diff --git a/include/linux/hdlc.h b/include/linux/hdlc.h
index c59769693be..fd47a151665 100644
--- a/include/linux/hdlc.h
+++ b/include/linux/hdlc.h
@@ -43,7 +43,7 @@ struct hdlc_proto {
43}; 43};
44 44
45 45
46/* Pointed to by dev->priv */ 46/* Pointed to by netdev_priv(dev) */
47typedef struct hdlc_device { 47typedef struct hdlc_device {
48 /* used by HDLC layer to take control over HDLC device from hw driver*/ 48 /* used by HDLC layer to take control over HDLC device from hw driver*/
49 int (*attach)(struct net_device *dev, 49 int (*attach)(struct net_device *dev,
@@ -80,7 +80,7 @@ struct net_device *alloc_hdlcdev(void *priv);
80 80
81static inline struct hdlc_device* dev_to_hdlc(struct net_device *dev) 81static inline struct hdlc_device* dev_to_hdlc(struct net_device *dev)
82{ 82{
83 return dev->priv; 83 return netdev_priv(dev);
84} 84}
85 85
86static __inline__ void debug_frame(const struct sk_buff *skb) 86static __inline__ void debug_frame(const struct sk_buff *skb)
diff --git a/include/linux/hippidevice.h b/include/linux/hippidevice.h
index bab303dafd6..f148e490841 100644
--- a/include/linux/hippidevice.h
+++ b/include/linux/hippidevice.h
@@ -32,7 +32,9 @@ struct hippi_cb {
32}; 32};
33 33
34extern __be16 hippi_type_trans(struct sk_buff *skb, struct net_device *dev); 34extern __be16 hippi_type_trans(struct sk_buff *skb, struct net_device *dev);
35 35extern int hippi_change_mtu(struct net_device *dev, int new_mtu);
36extern int hippi_mac_addr(struct net_device *dev, void *p);
37extern int hippi_neigh_setup_dev(struct net_device *dev, struct neigh_parms *p);
36extern struct net_device *alloc_hippi_dev(int sizeof_priv); 38extern struct net_device *alloc_hippi_dev(int sizeof_priv);
37#endif 39#endif
38 40
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index 3eba43878dc..bd37078c2d7 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -43,26 +43,6 @@ enum hrtimer_restart {
43}; 43};
44 44
45/* 45/*
46 * hrtimer callback modes:
47 *
48 * HRTIMER_CB_SOFTIRQ: Callback must run in softirq context
49 * HRTIMER_CB_IRQSAFE_PERCPU: Callback must run in hardirq context
50 * Special mode for tick emulation and
51 * scheduler timer. Such timers are per
52 * cpu and not allowed to be migrated on
53 * cpu unplug.
54 * HRTIMER_CB_IRQSAFE_UNLOCKED: Callback should run in hardirq context
55 * with timer->base lock unlocked
56 * used for timers which call wakeup to
57 * avoid lock order problems with rq->lock
58 */
59enum hrtimer_cb_mode {
60 HRTIMER_CB_SOFTIRQ,
61 HRTIMER_CB_IRQSAFE_PERCPU,
62 HRTIMER_CB_IRQSAFE_UNLOCKED,
63};
64
65/*
66 * Values to track state of the timer 46 * Values to track state of the timer
67 * 47 *
68 * Possible states: 48 * Possible states:
@@ -70,7 +50,6 @@ enum hrtimer_cb_mode {
70 * 0x00 inactive 50 * 0x00 inactive
71 * 0x01 enqueued into rbtree 51 * 0x01 enqueued into rbtree
72 * 0x02 callback function running 52 * 0x02 callback function running
73 * 0x04 callback pending (high resolution mode)
74 * 53 *
75 * Special cases: 54 * Special cases:
76 * 0x03 callback function running and enqueued 55 * 0x03 callback function running and enqueued
@@ -92,8 +71,7 @@ enum hrtimer_cb_mode {
92#define HRTIMER_STATE_INACTIVE 0x00 71#define HRTIMER_STATE_INACTIVE 0x00
93#define HRTIMER_STATE_ENQUEUED 0x01 72#define HRTIMER_STATE_ENQUEUED 0x01
94#define HRTIMER_STATE_CALLBACK 0x02 73#define HRTIMER_STATE_CALLBACK 0x02
95#define HRTIMER_STATE_PENDING 0x04 74#define HRTIMER_STATE_MIGRATE 0x04
96#define HRTIMER_STATE_MIGRATE 0x08
97 75
98/** 76/**
99 * struct hrtimer - the basic hrtimer structure 77 * struct hrtimer - the basic hrtimer structure
@@ -109,8 +87,6 @@ enum hrtimer_cb_mode {
109 * @function: timer expiry callback function 87 * @function: timer expiry callback function
110 * @base: pointer to the timer base (per cpu and per clock) 88 * @base: pointer to the timer base (per cpu and per clock)
111 * @state: state information (See bit values above) 89 * @state: state information (See bit values above)
112 * @cb_mode: high resolution timer feature to select the callback execution
113 * mode
114 * @cb_entry: list head to enqueue an expired timer into the callback list 90 * @cb_entry: list head to enqueue an expired timer into the callback list
115 * @start_site: timer statistics field to store the site where the timer 91 * @start_site: timer statistics field to store the site where the timer
116 * was started 92 * was started
@@ -129,7 +105,6 @@ struct hrtimer {
129 struct hrtimer_clock_base *base; 105 struct hrtimer_clock_base *base;
130 unsigned long state; 106 unsigned long state;
131 struct list_head cb_entry; 107 struct list_head cb_entry;
132 enum hrtimer_cb_mode cb_mode;
133#ifdef CONFIG_TIMER_STATS 108#ifdef CONFIG_TIMER_STATS
134 int start_pid; 109 int start_pid;
135 void *start_site; 110 void *start_site;
@@ -188,15 +163,11 @@ struct hrtimer_clock_base {
188 * @check_clocks: Indictator, when set evaluate time source and clock 163 * @check_clocks: Indictator, when set evaluate time source and clock
189 * event devices whether high resolution mode can be 164 * event devices whether high resolution mode can be
190 * activated. 165 * activated.
191 * @cb_pending: Expired timers are moved from the rbtree to this
192 * list in the timer interrupt. The list is processed
193 * in the softirq.
194 * @nr_events: Total number of timer interrupt events 166 * @nr_events: Total number of timer interrupt events
195 */ 167 */
196struct hrtimer_cpu_base { 168struct hrtimer_cpu_base {
197 spinlock_t lock; 169 spinlock_t lock;
198 struct hrtimer_clock_base clock_base[HRTIMER_MAX_CLOCK_BASES]; 170 struct hrtimer_clock_base clock_base[HRTIMER_MAX_CLOCK_BASES];
199 struct list_head cb_pending;
200#ifdef CONFIG_HIGH_RES_TIMERS 171#ifdef CONFIG_HIGH_RES_TIMERS
201 ktime_t expires_next; 172 ktime_t expires_next;
202 int hres_active; 173 int hres_active;
@@ -404,8 +375,7 @@ static inline int hrtimer_active(const struct hrtimer *timer)
404 */ 375 */
405static inline int hrtimer_is_queued(struct hrtimer *timer) 376static inline int hrtimer_is_queued(struct hrtimer *timer)
406{ 377{
407 return timer->state & 378 return timer->state & HRTIMER_STATE_ENQUEUED;
408 (HRTIMER_STATE_ENQUEUED | HRTIMER_STATE_PENDING);
409} 379}
410 380
411/* 381/*
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 010fb26a157..e99c56de7f5 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -122,8 +122,6 @@ struct ide_io_ports {
122#define MAX_DRIVES 2 /* per interface; 2 assumed by lots of code */ 122#define MAX_DRIVES 2 /* per interface; 2 assumed by lots of code */
123#define SECTOR_SIZE 512 123#define SECTOR_SIZE 512
124 124
125#define IDE_LARGE_SEEK(b1,b2,t) (((b1) > (b2) + (t)) || ((b2) > (b1) + (t)))
126
127/* 125/*
128 * Timeouts for various operations: 126 * Timeouts for various operations:
129 */ 127 */
@@ -172,9 +170,7 @@ typedef int (ide_ack_intr_t)(struct hwif_s *);
172enum { ide_unknown, ide_generic, ide_pci, 170enum { ide_unknown, ide_generic, ide_pci,
173 ide_cmd640, ide_dtc2278, ide_ali14xx, 171 ide_cmd640, ide_dtc2278, ide_ali14xx,
174 ide_qd65xx, ide_umc8672, ide_ht6560b, 172 ide_qd65xx, ide_umc8672, ide_ht6560b,
175 ide_rz1000, ide_trm290, 173 ide_4drives, ide_pmac, ide_acorn,
176 ide_cmd646, ide_cy82c693, ide_4drives,
177 ide_pmac, ide_acorn,
178 ide_au1xxx, ide_palm3710 174 ide_au1xxx, ide_palm3710
179}; 175};
180 176
@@ -496,8 +492,6 @@ enum {
496 * when more than one interrupt is needed. 492 * when more than one interrupt is needed.
497 */ 493 */
498 IDE_AFLAG_LIMIT_NFRAMES = (1 << 7), 494 IDE_AFLAG_LIMIT_NFRAMES = (1 << 7),
499 /* Seeking in progress. */
500 IDE_AFLAG_SEEKING = (1 << 8),
501 /* Saved TOC information is current. */ 495 /* Saved TOC information is current. */
502 IDE_AFLAG_TOC_VALID = (1 << 9), 496 IDE_AFLAG_TOC_VALID = (1 << 9),
503 /* We think that the drive door is locked. */ 497 /* We think that the drive door is locked. */
@@ -845,8 +839,6 @@ typedef struct hwif_s {
845 unsigned extra_ports; /* number of extra dma ports */ 839 unsigned extra_ports; /* number of extra dma ports */
846 840
847 unsigned present : 1; /* this interface exists */ 841 unsigned present : 1; /* this interface exists */
848 unsigned serialized : 1; /* serialized all channel operation */
849 unsigned sharing_irq: 1; /* 1 = sharing irq with another hwif */
850 unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */ 842 unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */
851 843
852 struct device gendev; 844 struct device gendev;
@@ -909,6 +901,8 @@ typedef struct hwgroup_s {
909 901
910 int req_gen; 902 int req_gen;
911 int req_gen_timer; 903 int req_gen_timer;
904
905 spinlock_t lock;
912} ide_hwgroup_t; 906} ide_hwgroup_t;
913 907
914typedef struct ide_driver_s ide_driver_t; 908typedef struct ide_driver_s ide_driver_t;
@@ -1122,6 +1116,14 @@ enum {
1122 IDE_PM_COMPLETED, 1116 IDE_PM_COMPLETED,
1123}; 1117};
1124 1118
1119int generic_ide_suspend(struct device *, pm_message_t);
1120int generic_ide_resume(struct device *);
1121
1122void ide_complete_power_step(ide_drive_t *, struct request *);
1123ide_startstop_t ide_start_power_step(ide_drive_t *, struct request *);
1124void ide_complete_pm_request(ide_drive_t *, struct request *);
1125void ide_check_pm_state(ide_drive_t *, struct request *);
1126
1125/* 1127/*
1126 * Subdrivers support. 1128 * Subdrivers support.
1127 * 1129 *
@@ -1376,8 +1378,8 @@ enum {
1376 IDE_HFLAG_LEGACY_IRQS = (1 << 21), 1378 IDE_HFLAG_LEGACY_IRQS = (1 << 21),
1377 /* force use of legacy IRQs */ 1379 /* force use of legacy IRQs */
1378 IDE_HFLAG_FORCE_LEGACY_IRQS = (1 << 22), 1380 IDE_HFLAG_FORCE_LEGACY_IRQS = (1 << 22),
1379 /* limit LBA48 requests to 256 sectors */ 1381 /* host is TRM290 */
1380 IDE_HFLAG_RQSIZE_256 = (1 << 23), 1382 IDE_HFLAG_TRM290 = (1 << 23),
1381 /* use 32-bit I/O ops */ 1383 /* use 32-bit I/O ops */
1382 IDE_HFLAG_IO_32BIT = (1 << 24), 1384 IDE_HFLAG_IO_32BIT = (1 << 24),
1383 /* unmask IRQs */ 1385 /* unmask IRQs */
@@ -1415,6 +1417,9 @@ struct ide_port_info {
1415 1417
1416 ide_pci_enablebit_t enablebits[2]; 1418 ide_pci_enablebit_t enablebits[2];
1417 hwif_chipset_t chipset; 1419 hwif_chipset_t chipset;
1420
1421 u16 max_sectors; /* if < than the default one */
1422
1418 u32 host_flags; 1423 u32 host_flags;
1419 u8 pio_mask; 1424 u8 pio_mask;
1420 u8 swdma_mask; 1425 u8 swdma_mask;
@@ -1610,13 +1615,13 @@ extern struct mutex ide_cfg_mtx;
1610/* 1615/*
1611 * Structure locking: 1616 * Structure locking:
1612 * 1617 *
1613 * ide_cfg_mtx and ide_lock together protect changes to 1618 * ide_cfg_mtx and hwgroup->lock together protect changes to
1614 * ide_hwif_t->{next,hwgroup} 1619 * ide_hwif_t->next
1615 * ide_drive_t->next 1620 * ide_drive_t->next
1616 * 1621 *
1617 * ide_hwgroup_t->busy: ide_lock 1622 * ide_hwgroup_t->busy: hwgroup->lock
1618 * ide_hwgroup_t->hwif: ide_lock 1623 * ide_hwgroup_t->hwif: hwgroup->lock
1619 * ide_hwif_t->mate: constant, no locking 1624 * ide_hwif_t->{hwgroup,mate}: constant, no locking
1620 * ide_drive_t->hwif: constant, no locking 1625 * ide_drive_t->hwif: constant, no locking
1621 */ 1626 */
1622 1627
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 14126bc3664..c4e6ca1a630 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -12,8 +12,8 @@
12 * published by the Free Software Foundation. 12 * published by the Free Software Foundation.
13 */ 13 */
14 14
15#ifndef IEEE80211_H 15#ifndef LINUX_IEEE80211_H
16#define IEEE80211_H 16#define LINUX_IEEE80211_H
17 17
18#include <linux/types.h> 18#include <linux/types.h>
19#include <asm/byteorder.h> 19#include <asm/byteorder.h>
@@ -97,7 +97,10 @@
97#define IEEE80211_MAX_FRAME_LEN 2352 97#define IEEE80211_MAX_FRAME_LEN 2352
98 98
99#define IEEE80211_MAX_SSID_LEN 32 99#define IEEE80211_MAX_SSID_LEN 32
100
100#define IEEE80211_MAX_MESH_ID_LEN 32 101#define IEEE80211_MAX_MESH_ID_LEN 32
102#define IEEE80211_MESH_CONFIG_LEN 19
103
101#define IEEE80211_QOS_CTL_LEN 2 104#define IEEE80211_QOS_CTL_LEN 2
102#define IEEE80211_QOS_CTL_TID_MASK 0x000F 105#define IEEE80211_QOS_CTL_TID_MASK 0x000F
103#define IEEE80211_QOS_CTL_TAG1D_MASK 0x0007 106#define IEEE80211_QOS_CTL_TAG1D_MASK 0x0007
@@ -666,6 +669,13 @@ struct ieee80211_cts {
666 u8 ra[6]; 669 u8 ra[6];
667} __attribute__ ((packed)); 670} __attribute__ ((packed));
668 671
672struct ieee80211_pspoll {
673 __le16 frame_control;
674 __le16 aid;
675 u8 bssid[6];
676 u8 ta[6];
677} __attribute__ ((packed));
678
669/** 679/**
670 * struct ieee80211_bar - HT Block Ack Request 680 * struct ieee80211_bar - HT Block Ack Request
671 * 681 *
@@ -685,28 +695,88 @@ struct ieee80211_bar {
685#define IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL 0x0000 695#define IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL 0x0000
686#define IEEE80211_BAR_CTRL_CBMTID_COMPRESSED_BA 0x0004 696#define IEEE80211_BAR_CTRL_CBMTID_COMPRESSED_BA 0x0004
687 697
698
699#define IEEE80211_HT_MCS_MASK_LEN 10
700
701/**
702 * struct ieee80211_mcs_info - MCS information
703 * @rx_mask: RX mask
704 * @rx_highest: highest supported RX rate
705 * @tx_params: TX parameters
706 */
707struct ieee80211_mcs_info {
708 u8 rx_mask[IEEE80211_HT_MCS_MASK_LEN];
709 __le16 rx_highest;
710 u8 tx_params;
711 u8 reserved[3];
712} __attribute__((packed));
713
714/* 802.11n HT capability MSC set */
715#define IEEE80211_HT_MCS_RX_HIGHEST_MASK 0x3ff
716#define IEEE80211_HT_MCS_TX_DEFINED 0x01
717#define IEEE80211_HT_MCS_TX_RX_DIFF 0x02
718/* value 0 == 1 stream etc */
719#define IEEE80211_HT_MCS_TX_MAX_STREAMS_MASK 0x0C
720#define IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT 2
721#define IEEE80211_HT_MCS_TX_MAX_STREAMS 4
722#define IEEE80211_HT_MCS_TX_UNEQUAL_MODULATION 0x10
723
724/*
725 * 802.11n D5.0 20.3.5 / 20.6 says:
726 * - indices 0 to 7 and 32 are single spatial stream
727 * - 8 to 31 are multiple spatial streams using equal modulation
728 * [8..15 for two streams, 16..23 for three and 24..31 for four]
729 * - remainder are multiple spatial streams using unequal modulation
730 */
731#define IEEE80211_HT_MCS_UNEQUAL_MODULATION_START 33
732#define IEEE80211_HT_MCS_UNEQUAL_MODULATION_START_BYTE \
733 (IEEE80211_HT_MCS_UNEQUAL_MODULATION_START / 8)
734
688/** 735/**
689 * struct ieee80211_ht_cap - HT capabilities 736 * struct ieee80211_ht_cap - HT capabilities
690 * 737 *
691 * This structure refers to "HT capabilities element" as 738 * This structure is the "HT capabilities element" as
692 * described in 802.11n draft section 7.3.2.52 739 * described in 802.11n D5.0 7.3.2.57
693 */ 740 */
694struct ieee80211_ht_cap { 741struct ieee80211_ht_cap {
695 __le16 cap_info; 742 __le16 cap_info;
696 u8 ampdu_params_info; 743 u8 ampdu_params_info;
697 u8 supp_mcs_set[16]; 744
745 /* 16 bytes MCS information */
746 struct ieee80211_mcs_info mcs;
747
698 __le16 extended_ht_cap_info; 748 __le16 extended_ht_cap_info;
699 __le32 tx_BF_cap_info; 749 __le32 tx_BF_cap_info;
700 u8 antenna_selection_info; 750 u8 antenna_selection_info;
701} __attribute__ ((packed)); 751} __attribute__ ((packed));
702 752
753/* 802.11n HT capabilities masks (for cap_info) */
754#define IEEE80211_HT_CAP_LDPC_CODING 0x0001
755#define IEEE80211_HT_CAP_SUP_WIDTH_20_40 0x0002
756#define IEEE80211_HT_CAP_SM_PS 0x000C
757#define IEEE80211_HT_CAP_GRN_FLD 0x0010
758#define IEEE80211_HT_CAP_SGI_20 0x0020
759#define IEEE80211_HT_CAP_SGI_40 0x0040
760#define IEEE80211_HT_CAP_TX_STBC 0x0080
761#define IEEE80211_HT_CAP_RX_STBC 0x0300
762#define IEEE80211_HT_CAP_DELAY_BA 0x0400
763#define IEEE80211_HT_CAP_MAX_AMSDU 0x0800
764#define IEEE80211_HT_CAP_DSSSCCK40 0x1000
765#define IEEE80211_HT_CAP_PSMP_SUPPORT 0x2000
766#define IEEE80211_HT_CAP_40MHZ_INTOLERANT 0x4000
767#define IEEE80211_HT_CAP_LSIG_TXOP_PROT 0x8000
768
769/* 802.11n HT capability AMPDU settings (for ampdu_params_info) */
770#define IEEE80211_HT_AMPDU_PARM_FACTOR 0x03
771#define IEEE80211_HT_AMPDU_PARM_DENSITY 0x1C
772
703/** 773/**
704 * struct ieee80211_ht_cap - HT additional information 774 * struct ieee80211_ht_info - HT information
705 * 775 *
706 * This structure refers to "HT information element" as 776 * This structure is the "HT information element" as
707 * described in 802.11n draft section 7.3.2.53 777 * described in 802.11n D5.0 7.3.2.58
708 */ 778 */
709struct ieee80211_ht_addt_info { 779struct ieee80211_ht_info {
710 u8 control_chan; 780 u8 control_chan;
711 u8 ht_param; 781 u8 ht_param;
712 __le16 operation_mode; 782 __le16 operation_mode;
@@ -714,36 +784,33 @@ struct ieee80211_ht_addt_info {
714 u8 basic_set[16]; 784 u8 basic_set[16];
715} __attribute__ ((packed)); 785} __attribute__ ((packed));
716 786
717/* 802.11n HT capabilities masks */ 787/* for ht_param */
718#define IEEE80211_HT_CAP_SUP_WIDTH 0x0002 788#define IEEE80211_HT_PARAM_CHA_SEC_OFFSET 0x03
719#define IEEE80211_HT_CAP_SM_PS 0x000C 789#define IEEE80211_HT_PARAM_CHA_SEC_NONE 0x00
720#define IEEE80211_HT_CAP_GRN_FLD 0x0010 790#define IEEE80211_HT_PARAM_CHA_SEC_ABOVE 0x01
721#define IEEE80211_HT_CAP_SGI_20 0x0020 791#define IEEE80211_HT_PARAM_CHA_SEC_BELOW 0x03
722#define IEEE80211_HT_CAP_SGI_40 0x0040 792#define IEEE80211_HT_PARAM_CHAN_WIDTH_ANY 0x04
723#define IEEE80211_HT_CAP_DELAY_BA 0x0400 793#define IEEE80211_HT_PARAM_RIFS_MODE 0x08
724#define IEEE80211_HT_CAP_MAX_AMSDU 0x0800 794#define IEEE80211_HT_PARAM_SPSMP_SUPPORT 0x10
725#define IEEE80211_HT_CAP_DSSSCCK40 0x1000 795#define IEEE80211_HT_PARAM_SERV_INTERVAL_GRAN 0xE0
726/* 802.11n HT capability AMPDU settings */ 796
727#define IEEE80211_HT_CAP_AMPDU_FACTOR 0x03 797/* for operation_mode */
728#define IEEE80211_HT_CAP_AMPDU_DENSITY 0x1C 798#define IEEE80211_HT_OP_MODE_PROTECTION 0x0003
729/* 802.11n HT capability MSC set */ 799#define IEEE80211_HT_OP_MODE_PROTECTION_NONE 0
730#define IEEE80211_SUPP_MCS_SET_UEQM 4 800#define IEEE80211_HT_OP_MODE_PROTECTION_NONMEMBER 1
731#define IEEE80211_HT_CAP_MAX_STREAMS 4 801#define IEEE80211_HT_OP_MODE_PROTECTION_20MHZ 2
732#define IEEE80211_SUPP_MCS_SET_LEN 10 802#define IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED 3
733/* maximum streams the spec allows */ 803#define IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT 0x0004
734#define IEEE80211_HT_CAP_MCS_TX_DEFINED 0x01 804#define IEEE80211_HT_OP_MODE_NON_HT_STA_PRSNT 0x0010
735#define IEEE80211_HT_CAP_MCS_TX_RX_DIFF 0x02 805
736#define IEEE80211_HT_CAP_MCS_TX_STREAMS 0x0C 806/* for stbc_param */
737#define IEEE80211_HT_CAP_MCS_TX_UEQM 0x10 807#define IEEE80211_HT_STBC_PARAM_DUAL_BEACON 0x0040
738/* 802.11n HT IE masks */ 808#define IEEE80211_HT_STBC_PARAM_DUAL_CTS_PROT 0x0080
739#define IEEE80211_HT_IE_CHA_SEC_OFFSET 0x03 809#define IEEE80211_HT_STBC_PARAM_STBC_BEACON 0x0100
740#define IEEE80211_HT_IE_CHA_SEC_NONE 0x00 810#define IEEE80211_HT_STBC_PARAM_LSIG_TXOP_FULLPROT 0x0200
741#define IEEE80211_HT_IE_CHA_SEC_ABOVE 0x01 811#define IEEE80211_HT_STBC_PARAM_PCO_ACTIVE 0x0400
742#define IEEE80211_HT_IE_CHA_SEC_BELOW 0x03 812#define IEEE80211_HT_STBC_PARAM_PCO_PHASE 0x0800
743#define IEEE80211_HT_IE_CHA_WIDTH 0x04 813
744#define IEEE80211_HT_IE_HT_PROTECTION 0x0003
745#define IEEE80211_HT_IE_NON_GF_STA_PRSNT 0x0004
746#define IEEE80211_HT_IE_NON_HT_STA_PRSNT 0x0010
747 814
748/* block-ack parameters */ 815/* block-ack parameters */
749#define IEEE80211_ADDBA_PARAM_POLICY_MASK 0x0002 816#define IEEE80211_ADDBA_PARAM_POLICY_MASK 0x0002
@@ -769,7 +836,6 @@ struct ieee80211_ht_addt_info {
769/* Authentication algorithms */ 836/* Authentication algorithms */
770#define WLAN_AUTH_OPEN 0 837#define WLAN_AUTH_OPEN 0
771#define WLAN_AUTH_SHARED_KEY 1 838#define WLAN_AUTH_SHARED_KEY 1
772#define WLAN_AUTH_FAST_BSS_TRANSITION 2
773#define WLAN_AUTH_LEAP 128 839#define WLAN_AUTH_LEAP 128
774 840
775#define WLAN_AUTH_CHALLENGE_LEN 128 841#define WLAN_AUTH_CHALLENGE_LEN 128
@@ -949,7 +1015,7 @@ enum ieee80211_eid {
949 WLAN_EID_EXT_SUPP_RATES = 50, 1015 WLAN_EID_EXT_SUPP_RATES = 50,
950 /* 802.11n */ 1016 /* 802.11n */
951 WLAN_EID_HT_CAPABILITY = 45, 1017 WLAN_EID_HT_CAPABILITY = 45,
952 WLAN_EID_HT_EXTRA_INFO = 61, 1018 WLAN_EID_HT_INFORMATION = 61,
953 /* 802.11i */ 1019 /* 802.11i */
954 WLAN_EID_RSN = 48, 1020 WLAN_EID_RSN = 48,
955 WLAN_EID_WPA = 221, 1021 WLAN_EID_WPA = 221,
@@ -976,6 +1042,68 @@ enum ieee80211_spectrum_mgmt_actioncode {
976 WLAN_ACTION_SPCT_CHL_SWITCH = 4, 1042 WLAN_ACTION_SPCT_CHL_SWITCH = 4,
977}; 1043};
978 1044
1045/*
1046 * IEEE 802.11-2007 7.3.2.9 Country information element
1047 *
1048 * Minimum length is 8 octets, ie len must be evenly
1049 * divisible by 2
1050 */
1051
1052/* Although the spec says 8 I'm seeing 6 in practice */
1053#define IEEE80211_COUNTRY_IE_MIN_LEN 6
1054
1055/*
1056 * For regulatory extension stuff see IEEE 802.11-2007
1057 * Annex I (page 1141) and Annex J (page 1147). Also
1058 * review 7.3.2.9.
1059 *
1060 * When dot11RegulatoryClassesRequired is true and the
1061 * first_channel/reg_extension_id is >= 201 then the IE
1062 * compromises of the 'ext' struct represented below:
1063 *
1064 * - Regulatory extension ID - when generating IE this just needs
1065 * to be monotonically increasing for each triplet passed in
1066 * the IE
1067 * - Regulatory class - index into set of rules
1068 * - Coverage class - index into air propagation time (Table 7-27),
1069 * in microseconds, you can compute the air propagation time from
1070 * the index by multiplying by 3, so index 10 yields a propagation
1071 * of 10 us. Valid values are 0-31, values 32-255 are not defined
1072 * yet. A value of 0 inicates air propagation of <= 1 us.
1073 *
1074 * See also Table I.2 for Emission limit sets and table
1075 * I.3 for Behavior limit sets. Table J.1 indicates how to map
1076 * a reg_class to an emission limit set and behavior limit set.
1077 */
1078#define IEEE80211_COUNTRY_EXTENSION_ID 201
1079
1080/*
1081 * Channels numbers in the IE must be monotonically increasing
1082 * if dot11RegulatoryClassesRequired is not true.
1083 *
1084 * If dot11RegulatoryClassesRequired is true consecutive
1085 * subband triplets following a regulatory triplet shall
1086 * have monotonically increasing first_channel number fields.
1087 *
1088 * Channel numbers shall not overlap.
1089 *
1090 * Note that max_power is signed.
1091 */
1092struct ieee80211_country_ie_triplet {
1093 union {
1094 struct {
1095 u8 first_channel;
1096 u8 num_channels;
1097 s8 max_power;
1098 } __attribute__ ((packed)) chans;
1099 struct {
1100 u8 reg_extension_id;
1101 u8 reg_class;
1102 u8 coverage_class;
1103 } __attribute__ ((packed)) ext;
1104 };
1105} __attribute__ ((packed));
1106
979/* BACK action code */ 1107/* BACK action code */
980enum ieee80211_back_actioncode { 1108enum ieee80211_back_actioncode {
981 WLAN_ACTION_ADDBA_REQ = 0, 1109 WLAN_ACTION_ADDBA_REQ = 0,
@@ -1057,4 +1185,4 @@ static inline u8 *ieee80211_get_DA(struct ieee80211_hdr *hdr)
1057 return hdr->addr1; 1185 return hdr->addr1;
1058} 1186}
1059 1187
1060#endif /* IEEE80211_H */ 1188#endif /* LINUX_IEEE80211_H */
diff --git a/include/linux/if.h b/include/linux/if.h
index 65246846c84..2a6e29620a9 100644
--- a/include/linux/if.h
+++ b/include/linux/if.h
@@ -65,6 +65,7 @@
65#define IFF_BONDING 0x20 /* bonding master or slave */ 65#define IFF_BONDING 0x20 /* bonding master or slave */
66#define IFF_SLAVE_NEEDARP 0x40 /* need ARPs for validation */ 66#define IFF_SLAVE_NEEDARP 0x40 /* need ARPs for validation */
67#define IFF_ISATAP 0x80 /* ISATAP interface (RFC4214) */ 67#define IFF_ISATAP 0x80 /* ISATAP interface (RFC4214) */
68#define IFF_MASTER_ARPMON 0x100 /* bonding master, ARP mon in use */
68 69
69#define IF_GET_IFACE 0x0001 /* for querying only */ 70#define IF_GET_IFACE 0x0001 /* for querying only */
70#define IF_GET_PROTO 0x0002 71#define IF_GET_PROTO 0x0002
diff --git a/include/linux/if_arp.h b/include/linux/if_arp.h
index 4d3401812e6..5ff89809a58 100644
--- a/include/linux/if_arp.h
+++ b/include/linux/if_arp.h
@@ -87,6 +87,9 @@
87#define ARPHRD_IEEE80211_PRISM 802 /* IEEE 802.11 + Prism2 header */ 87#define ARPHRD_IEEE80211_PRISM 802 /* IEEE 802.11 + Prism2 header */
88#define ARPHRD_IEEE80211_RADIOTAP 803 /* IEEE 802.11 + radiotap header */ 88#define ARPHRD_IEEE80211_RADIOTAP 803 /* IEEE 802.11 + radiotap header */
89 89
90#define ARPHRD_PHONET 820 /* PhoNet media type */
91#define ARPHRD_PHONET_PIPE 821 /* PhoNet pipe header */
92
90#define ARPHRD_VOID 0xFFFF /* Void type, nothing is known */ 93#define ARPHRD_VOID 0xFFFF /* Void type, nothing is known */
91#define ARPHRD_NONE 0xFFFE /* zero header length */ 94#define ARPHRD_NONE 0xFFFE /* zero header length */
92 95
diff --git a/include/linux/in.h b/include/linux/in.h
index db458beef19..d60122a3a08 100644
--- a/include/linux/in.h
+++ b/include/linux/in.h
@@ -80,6 +80,10 @@ struct in_addr {
80/* BSD compatibility */ 80/* BSD compatibility */
81#define IP_RECVRETOPTS IP_RETOPTS 81#define IP_RECVRETOPTS IP_RETOPTS
82 82
83/* TProxy original addresses */
84#define IP_ORIGDSTADDR 20
85#define IP_RECVORIGDSTADDR IP_ORIGDSTADDR
86
83/* IP_MTU_DISCOVER values */ 87/* IP_MTU_DISCOVER values */
84#define IP_PMTUDISC_DONT 0 /* Never send DF frames */ 88#define IP_PMTUDISC_DONT 0 /* Never send DF frames */
85#define IP_PMTUDISC_WANT 1 /* Use per route hints */ 89#define IP_PMTUDISC_WANT 1 /* Use per route hints */
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index 23fd8909b9e..959f5522d10 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -57,7 +57,6 @@ extern struct nsproxy init_nsproxy;
57 .mnt_ns = NULL, \ 57 .mnt_ns = NULL, \
58 INIT_NET_NS(net_ns) \ 58 INIT_NET_NS(net_ns) \
59 INIT_IPC_NS(ipc_ns) \ 59 INIT_IPC_NS(ipc_ns) \
60 .user_ns = &init_user_ns, \
61} 60}
62 61
63#define INIT_SIGHAND(sighand) { \ 62#define INIT_SIGHAND(sighand) { \
@@ -113,6 +112,8 @@ extern struct group_info init_groups;
113# define CAP_INIT_BSET CAP_INIT_EFF_SET 112# define CAP_INIT_BSET CAP_INIT_EFF_SET
114#endif 113#endif
115 114
115extern struct cred init_cred;
116
116/* 117/*
117 * INIT_TASK is used to set up the first task table, touch at 118 * INIT_TASK is used to set up the first task table, touch at
118 * your own risk!. Base=0, limit=0x1fffff (=2MB) 119 * your own risk!. Base=0, limit=0x1fffff (=2MB)
@@ -147,13 +148,10 @@ extern struct group_info init_groups;
147 .children = LIST_HEAD_INIT(tsk.children), \ 148 .children = LIST_HEAD_INIT(tsk.children), \
148 .sibling = LIST_HEAD_INIT(tsk.sibling), \ 149 .sibling = LIST_HEAD_INIT(tsk.sibling), \
149 .group_leader = &tsk, \ 150 .group_leader = &tsk, \
150 .group_info = &init_groups, \ 151 .real_cred = &init_cred, \
151 .cap_effective = CAP_INIT_EFF_SET, \ 152 .cred = &init_cred, \
152 .cap_inheritable = CAP_INIT_INH_SET, \ 153 .cred_exec_mutex = \
153 .cap_permitted = CAP_FULL_SET, \ 154 __MUTEX_INITIALIZER(tsk.cred_exec_mutex), \
154 .cap_bset = CAP_INIT_BSET, \
155 .securebits = SECUREBITS_DEFAULT, \
156 .user = INIT_USER, \
157 .comm = "swapper", \ 155 .comm = "swapper", \
158 .thread = INIT_THREAD, \ 156 .thread = INIT_THREAD, \
159 .fs = &init_fs, \ 157 .fs = &init_fs, \
diff --git a/include/linux/input.h b/include/linux/input.h
index 5341e8251f8..9a6355f74db 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -659,6 +659,8 @@ struct input_absinfo {
659#define SW_RADIO SW_RFKILL_ALL /* deprecated */ 659#define SW_RADIO SW_RFKILL_ALL /* deprecated */
660#define SW_MICROPHONE_INSERT 0x04 /* set = inserted */ 660#define SW_MICROPHONE_INSERT 0x04 /* set = inserted */
661#define SW_DOCK 0x05 /* set = plugged into dock */ 661#define SW_DOCK 0x05 /* set = plugged into dock */
662#define SW_LINEOUT_INSERT 0x06 /* set = inserted */
663#define SW_JACK_PHYSICAL_INSERT 0x07 /* set = mechanical switch set */
662#define SW_MAX 0x0f 664#define SW_MAX 0x0f
663#define SW_CNT (SW_MAX+1) 665#define SW_CNT (SW_MAX+1)
664 666
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 7e85a6e89e4..91f1ef8e581 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -109,7 +109,7 @@ extern void enable_irq(unsigned int irq);
109 109
110#if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_HARDIRQS) 110#if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_HARDIRQS)
111 111
112extern cpumask_t irq_default_affinity; 112extern cpumask_var_t irq_default_affinity;
113 113
114extern int irq_set_affinity(unsigned int irq, const struct cpumask *cpumask); 114extern int irq_set_affinity(unsigned int irq, const struct cpumask *cpumask);
115extern int irq_can_set_affinity(unsigned int irq); 115extern int irq_can_set_affinity(unsigned int irq);
@@ -253,9 +253,6 @@ enum
253 BLOCK_SOFTIRQ, 253 BLOCK_SOFTIRQ,
254 TASKLET_SOFTIRQ, 254 TASKLET_SOFTIRQ,
255 SCHED_SOFTIRQ, 255 SCHED_SOFTIRQ,
256#ifdef CONFIG_HIGH_RES_TIMERS
257 HRTIMER_SOFTIRQ,
258#endif
259 RCU_SOFTIRQ, /* Preferable RCU should always be the last softirq */ 256 RCU_SOFTIRQ, /* Preferable RCU should always be the last softirq */
260 257
261 NR_SOFTIRQS 258 NR_SOFTIRQS
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 641e026eee8..0b816cae533 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -278,6 +278,7 @@ struct ipv6_pinfo {
278 struct in6_addr saddr; 278 struct in6_addr saddr;
279 struct in6_addr rcv_saddr; 279 struct in6_addr rcv_saddr;
280 struct in6_addr daddr; 280 struct in6_addr daddr;
281 struct in6_pktinfo sticky_pktinfo;
281 struct in6_addr *daddr_cache; 282 struct in6_addr *daddr_cache;
282#ifdef CONFIG_IPV6_SUBTREES 283#ifdef CONFIG_IPV6_SUBTREES
283 struct in6_addr *saddr_cache; 284 struct in6_addr *saddr_cache;
diff --git a/include/linux/irq.h b/include/linux/irq.h
index fde5e613201..5845bdc1ac0 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -135,6 +135,9 @@ struct irq_2_iommu;
135/** 135/**
136 * struct irq_desc - interrupt descriptor 136 * struct irq_desc - interrupt descriptor
137 * @irq: interrupt number for this descriptor 137 * @irq: interrupt number for this descriptor
138 * @timer_rand_state: pointer to timer rand state struct
139 * @kstat_irqs: irq stats per cpu
140 * @irq_2_iommu: iommu with this irq
138 * @handle_irq: highlevel irq-events handler [if NULL, __do_IRQ()] 141 * @handle_irq: highlevel irq-events handler [if NULL, __do_IRQ()]
139 * @chip: low level interrupt hardware access 142 * @chip: low level interrupt hardware access
140 * @msi_desc: MSI descriptor 143 * @msi_desc: MSI descriptor
@@ -146,8 +149,8 @@ struct irq_2_iommu;
146 * @depth: disable-depth, for nested irq_disable() calls 149 * @depth: disable-depth, for nested irq_disable() calls
147 * @wake_depth: enable depth, for multiple set_irq_wake() callers 150 * @wake_depth: enable depth, for multiple set_irq_wake() callers
148 * @irq_count: stats field to detect stalled irqs 151 * @irq_count: stats field to detect stalled irqs
149 * @irqs_unhandled: stats field for spurious unhandled interrupts
150 * @last_unhandled: aging timer for unhandled count 152 * @last_unhandled: aging timer for unhandled count
153 * @irqs_unhandled: stats field for spurious unhandled interrupts
151 * @lock: locking for SMP 154 * @lock: locking for SMP
152 * @affinity: IRQ affinity on SMP 155 * @affinity: IRQ affinity on SMP
153 * @cpu: cpu index useful for balancing 156 * @cpu: cpu index useful for balancing
@@ -175,8 +178,8 @@ struct irq_desc {
175 unsigned int depth; /* nested irq disables */ 178 unsigned int depth; /* nested irq disables */
176 unsigned int wake_depth; /* nested wake enables */ 179 unsigned int wake_depth; /* nested wake enables */
177 unsigned int irq_count; /* For detecting broken IRQs */ 180 unsigned int irq_count; /* For detecting broken IRQs */
178 unsigned int irqs_unhandled;
179 unsigned long last_unhandled; /* Aging timer for unhandled count */ 181 unsigned long last_unhandled; /* Aging timer for unhandled count */
182 unsigned int irqs_unhandled;
180 spinlock_t lock; 183 spinlock_t lock;
181#ifdef CONFIG_SMP 184#ifdef CONFIG_SMP
182 cpumask_t affinity; 185 cpumask_t affinity;
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
index abb6ac639e8..1a9cf78bfce 100644
--- a/include/linux/jiffies.h
+++ b/include/linux/jiffies.h
@@ -115,10 +115,20 @@ static inline u64 get_jiffies_64(void)
115 ((long)(a) - (long)(b) >= 0)) 115 ((long)(a) - (long)(b) >= 0))
116#define time_before_eq(a,b) time_after_eq(b,a) 116#define time_before_eq(a,b) time_after_eq(b,a)
117 117
118/*
119 * Calculate whether a is in the range of [b, c].
120 */
118#define time_in_range(a,b,c) \ 121#define time_in_range(a,b,c) \
119 (time_after_eq(a,b) && \ 122 (time_after_eq(a,b) && \
120 time_before_eq(a,c)) 123 time_before_eq(a,c))
121 124
125/*
126 * Calculate whether a is in the range of [b, c).
127 */
128#define time_in_range_open(a,b,c) \
129 (time_after_eq(a,b) && \
130 time_before(a,c))
131
122/* Same as above, but does so with platform independent 64bit types. 132/* Same as above, but does so with platform independent 64bit types.
123 * These must be used when utilizing jiffies_64 (i.e. return value of 133 * These must be used when utilizing jiffies_64 (i.e. return value of
124 * get_jiffies_64() */ 134 * get_jiffies_64() */
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 269df5a17b3..ca9ff6411df 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -372,18 +372,6 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
372 ((unsigned char *)&addr)[3] 372 ((unsigned char *)&addr)[3]
373#define NIPQUAD_FMT "%u.%u.%u.%u" 373#define NIPQUAD_FMT "%u.%u.%u.%u"
374 374
375#define NIP6(addr) \
376 ntohs((addr).s6_addr16[0]), \
377 ntohs((addr).s6_addr16[1]), \
378 ntohs((addr).s6_addr16[2]), \
379 ntohs((addr).s6_addr16[3]), \
380 ntohs((addr).s6_addr16[4]), \
381 ntohs((addr).s6_addr16[5]), \
382 ntohs((addr).s6_addr16[6]), \
383 ntohs((addr).s6_addr16[7])
384#define NIP6_FMT "%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x"
385#define NIP6_SEQFMT "%04x%04x%04x%04x%04x%04x%04x%04x"
386
387#if defined(__LITTLE_ENDIAN) 375#if defined(__LITTLE_ENDIAN)
388#define HIPQUAD(addr) \ 376#define HIPQUAD(addr) \
389 ((unsigned char *)&addr)[3], \ 377 ((unsigned char *)&addr)[3], \
diff --git a/include/linux/key-ui.h b/include/linux/key-ui.h
deleted file mode 100644
index e8b8a7a5c49..00000000000
--- a/include/linux/key-ui.h
+++ /dev/null
@@ -1,66 +0,0 @@
1/* key-ui.h: key userspace interface stuff
2 *
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _LINUX_KEY_UI_H
13#define _LINUX_KEY_UI_H
14
15#include <linux/key.h>
16
17/* the key tree */
18extern struct rb_root key_serial_tree;
19extern spinlock_t key_serial_lock;
20
21/* required permissions */
22#define KEY_VIEW 0x01 /* require permission to view attributes */
23#define KEY_READ 0x02 /* require permission to read content */
24#define KEY_WRITE 0x04 /* require permission to update / modify */
25#define KEY_SEARCH 0x08 /* require permission to search (keyring) or find (key) */
26#define KEY_LINK 0x10 /* require permission to link */
27#define KEY_SETATTR 0x20 /* require permission to change attributes */
28#define KEY_ALL 0x3f /* all the above permissions */
29
30/*
31 * the keyring payload contains a list of the keys to which the keyring is
32 * subscribed
33 */
34struct keyring_list {
35 struct rcu_head rcu; /* RCU deletion hook */
36 unsigned short maxkeys; /* max keys this list can hold */
37 unsigned short nkeys; /* number of keys currently held */
38 unsigned short delkey; /* key to be unlinked by RCU */
39 struct key *keys[0];
40};
41
42/*
43 * check to see whether permission is granted to use a key in the desired way
44 */
45extern int key_task_permission(const key_ref_t key_ref,
46 struct task_struct *context,
47 key_perm_t perm);
48
49static inline int key_permission(const key_ref_t key_ref, key_perm_t perm)
50{
51 return key_task_permission(key_ref, current, perm);
52}
53
54extern key_ref_t lookup_user_key(struct task_struct *context,
55 key_serial_t id, int create, int partial,
56 key_perm_t perm);
57
58extern long join_session_keyring(const char *name);
59
60extern struct key_type *key_type_lookup(const char *type);
61extern void key_type_put(struct key_type *ktype);
62
63#define key_negative_timeout 60 /* default timeout on a negative key's existence */
64
65
66#endif /* _LINUX_KEY_UI_H */
diff --git a/include/linux/key.h b/include/linux/key.h
index 1b70e35a71e..21d32a142c0 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -73,6 +73,7 @@ struct key;
73struct seq_file; 73struct seq_file;
74struct user_struct; 74struct user_struct;
75struct signal_struct; 75struct signal_struct;
76struct cred;
76 77
77struct key_type; 78struct key_type;
78struct key_owner; 79struct key_owner;
@@ -181,7 +182,7 @@ struct key {
181extern struct key *key_alloc(struct key_type *type, 182extern struct key *key_alloc(struct key_type *type,
182 const char *desc, 183 const char *desc,
183 uid_t uid, gid_t gid, 184 uid_t uid, gid_t gid,
184 struct task_struct *ctx, 185 const struct cred *cred,
185 key_perm_t perm, 186 key_perm_t perm,
186 unsigned long flags); 187 unsigned long flags);
187 188
@@ -249,7 +250,7 @@ extern int key_unlink(struct key *keyring,
249 struct key *key); 250 struct key *key);
250 251
251extern struct key *keyring_alloc(const char *description, uid_t uid, gid_t gid, 252extern struct key *keyring_alloc(const char *description, uid_t uid, gid_t gid,
252 struct task_struct *ctx, 253 const struct cred *cred,
253 unsigned long flags, 254 unsigned long flags,
254 struct key *dest); 255 struct key *dest);
255 256
@@ -276,24 +277,11 @@ extern ctl_table key_sysctls[];
276/* 277/*
277 * the userspace interface 278 * the userspace interface
278 */ 279 */
279extern void switch_uid_keyring(struct user_struct *new_user); 280extern int install_thread_keyring_to_cred(struct cred *cred);
280extern int copy_keys(unsigned long clone_flags, struct task_struct *tsk);
281extern int copy_thread_group_keys(struct task_struct *tsk);
282extern void exit_keys(struct task_struct *tsk);
283extern void exit_thread_group_keys(struct signal_struct *tg);
284extern int suid_keys(struct task_struct *tsk);
285extern int exec_keys(struct task_struct *tsk);
286extern void key_fsuid_changed(struct task_struct *tsk); 281extern void key_fsuid_changed(struct task_struct *tsk);
287extern void key_fsgid_changed(struct task_struct *tsk); 282extern void key_fsgid_changed(struct task_struct *tsk);
288extern void key_init(void); 283extern void key_init(void);
289 284
290#define __install_session_keyring(tsk, keyring) \
291({ \
292 struct key *old_session = tsk->signal->session_keyring; \
293 tsk->signal->session_keyring = keyring; \
294 old_session; \
295})
296
297#else /* CONFIG_KEYS */ 285#else /* CONFIG_KEYS */
298 286
299#define key_validate(k) 0 287#define key_validate(k) 0
@@ -302,17 +290,9 @@ extern void key_init(void);
302#define key_revoke(k) do { } while(0) 290#define key_revoke(k) do { } while(0)
303#define key_put(k) do { } while(0) 291#define key_put(k) do { } while(0)
304#define key_ref_put(k) do { } while(0) 292#define key_ref_put(k) do { } while(0)
305#define make_key_ref(k, p) ({ NULL; }) 293#define make_key_ref(k, p) NULL
306#define key_ref_to_ptr(k) ({ NULL; }) 294#define key_ref_to_ptr(k) NULL
307#define is_key_possessed(k) 0 295#define is_key_possessed(k) 0
308#define switch_uid_keyring(u) do { } while(0)
309#define __install_session_keyring(t, k) ({ NULL; })
310#define copy_keys(f,t) 0
311#define copy_thread_group_keys(t) 0
312#define exit_keys(t) do { } while(0)
313#define exit_thread_group_keys(tg) do { } while(0)
314#define suid_keys(t) do { } while(0)
315#define exec_keys(t) do { } while(0)
316#define key_fsuid_changed(t) do { } while(0) 296#define key_fsuid_changed(t) do { } while(0)
317#define key_fsgid_changed(t) do { } while(0) 297#define key_fsgid_changed(t) do { } while(0)
318#define key_init() do { } while(0) 298#define key_init() do { } while(0)
diff --git a/include/linux/keyctl.h b/include/linux/keyctl.h
index 656ee6b77a4..c0688eb7209 100644
--- a/include/linux/keyctl.h
+++ b/include/linux/keyctl.h
@@ -1,6 +1,6 @@
1/* keyctl.h: keyctl command IDs 1/* keyctl.h: keyctl command IDs
2 * 2 *
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2004, 2008 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
5 * 5 *
6 * This program is free software; you can redistribute it and/or 6 * This program is free software; you can redistribute it and/or
@@ -20,6 +20,7 @@
20#define KEY_SPEC_USER_SESSION_KEYRING -5 /* - key ID for UID-session keyring */ 20#define KEY_SPEC_USER_SESSION_KEYRING -5 /* - key ID for UID-session keyring */
21#define KEY_SPEC_GROUP_KEYRING -6 /* - key ID for GID-specific keyring */ 21#define KEY_SPEC_GROUP_KEYRING -6 /* - key ID for GID-specific keyring */
22#define KEY_SPEC_REQKEY_AUTH_KEY -7 /* - key ID for assumed request_key auth key */ 22#define KEY_SPEC_REQKEY_AUTH_KEY -7 /* - key ID for assumed request_key auth key */
23#define KEY_SPEC_REQUESTOR_KEYRING -8 /* - key ID for request_key() dest keyring */
23 24
24/* request-key default keyrings */ 25/* request-key default keyrings */
25#define KEY_REQKEY_DEFL_NO_CHANGE -1 26#define KEY_REQKEY_DEFL_NO_CHANGE -1
@@ -30,6 +31,7 @@
30#define KEY_REQKEY_DEFL_USER_KEYRING 4 31#define KEY_REQKEY_DEFL_USER_KEYRING 4
31#define KEY_REQKEY_DEFL_USER_SESSION_KEYRING 5 32#define KEY_REQKEY_DEFL_USER_SESSION_KEYRING 5
32#define KEY_REQKEY_DEFL_GROUP_KEYRING 6 33#define KEY_REQKEY_DEFL_GROUP_KEYRING 6
34#define KEY_REQKEY_DEFL_REQUESTOR_KEYRING 7
33 35
34/* keyctl commands */ 36/* keyctl commands */
35#define KEYCTL_GET_KEYRING_ID 0 /* ask for a keyring's ID */ 37#define KEYCTL_GET_KEYRING_ID 0 /* ask for a keyring's ID */
diff --git a/include/linux/lguest_launcher.h b/include/linux/lguest_launcher.h
index e7217dc58f3..a53407a4165 100644
--- a/include/linux/lguest_launcher.h
+++ b/include/linux/lguest_launcher.h
@@ -54,9 +54,13 @@ struct lguest_vqconfig {
54/* Write command first word is a request. */ 54/* Write command first word is a request. */
55enum lguest_req 55enum lguest_req
56{ 56{
57 LHREQ_INITIALIZE, /* + base, pfnlimit, pgdir, start */ 57 LHREQ_INITIALIZE, /* + base, pfnlimit, start */
58 LHREQ_GETDMA, /* No longer used */ 58 LHREQ_GETDMA, /* No longer used */
59 LHREQ_IRQ, /* + irq */ 59 LHREQ_IRQ, /* + irq */
60 LHREQ_BREAK, /* + on/off flag (on blocks until someone does off) */ 60 LHREQ_BREAK, /* + on/off flag (on blocks until someone does off) */
61}; 61};
62
63/* The alignment to use between consumer and producer parts of vring.
64 * x86 pagesize for historical reasons. */
65#define LGUEST_VRING_ALIGN 4096
62#endif /* _LINUX_LGUEST_LAUNCHER */ 66#endif /* _LINUX_LGUEST_LAUNCHER */
diff --git a/include/linux/libata.h b/include/linux/libata.h
index ed3f26eb5df..3449de597ef 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -213,10 +213,11 @@ enum {
213 ATA_PFLAG_FROZEN = (1 << 2), /* port is frozen */ 213 ATA_PFLAG_FROZEN = (1 << 2), /* port is frozen */
214 ATA_PFLAG_RECOVERED = (1 << 3), /* recovery action performed */ 214 ATA_PFLAG_RECOVERED = (1 << 3), /* recovery action performed */
215 ATA_PFLAG_LOADING = (1 << 4), /* boot/loading probe */ 215 ATA_PFLAG_LOADING = (1 << 4), /* boot/loading probe */
216 ATA_PFLAG_UNLOADING = (1 << 5), /* module is unloading */
217 ATA_PFLAG_SCSI_HOTPLUG = (1 << 6), /* SCSI hotplug scheduled */ 216 ATA_PFLAG_SCSI_HOTPLUG = (1 << 6), /* SCSI hotplug scheduled */
218 ATA_PFLAG_INITIALIZING = (1 << 7), /* being initialized, don't touch */ 217 ATA_PFLAG_INITIALIZING = (1 << 7), /* being initialized, don't touch */
219 ATA_PFLAG_RESETTING = (1 << 8), /* reset in progress */ 218 ATA_PFLAG_RESETTING = (1 << 8), /* reset in progress */
219 ATA_PFLAG_UNLOADING = (1 << 9), /* driver is being unloaded */
220 ATA_PFLAG_UNLOADED = (1 << 10), /* driver is unloaded */
220 221
221 ATA_PFLAG_SUSPENDED = (1 << 17), /* port is suspended (power) */ 222 ATA_PFLAG_SUSPENDED = (1 << 17), /* port is suspended (power) */
222 ATA_PFLAG_PM_PENDING = (1 << 18), /* PM operation pending */ 223 ATA_PFLAG_PM_PENDING = (1 << 18), /* PM operation pending */
@@ -1285,26 +1286,62 @@ static inline int ata_link_active(struct ata_link *link)
1285 return ata_tag_valid(link->active_tag) || link->sactive; 1286 return ata_tag_valid(link->active_tag) || link->sactive;
1286} 1287}
1287 1288
1288extern struct ata_link *__ata_port_next_link(struct ata_port *ap, 1289/*
1289 struct ata_link *link, 1290 * Iterators
1290 bool dev_only); 1291 *
1292 * ATA_LITER_* constants are used to select link iteration mode and
1293 * ATA_DITER_* device iteration mode.
1294 *
1295 * For a custom iteration directly using ata_{link|dev}_next(), if
1296 * @link or @dev, respectively, is NULL, the first element is
1297 * returned. @dev and @link can be any valid device or link and the
1298 * next element according to the iteration mode will be returned.
1299 * After the last element, NULL is returned.
1300 */
1301enum ata_link_iter_mode {
1302 ATA_LITER_EDGE, /* if present, PMP links only; otherwise,
1303 * host link. no slave link */
1304 ATA_LITER_HOST_FIRST, /* host link followed by PMP or slave links */
1305 ATA_LITER_PMP_FIRST, /* PMP links followed by host link,
1306 * slave link still comes after host link */
1307};
1291 1308
1292#define __ata_port_for_each_link(link, ap) \ 1309enum ata_dev_iter_mode {
1293 for ((link) = __ata_port_next_link((ap), NULL, false); (link); \ 1310 ATA_DITER_ENABLED,
1294 (link) = __ata_port_next_link((ap), (link), false)) 1311 ATA_DITER_ENABLED_REVERSE,
1312 ATA_DITER_ALL,
1313 ATA_DITER_ALL_REVERSE,
1314};
1295 1315
1296#define ata_port_for_each_link(link, ap) \ 1316extern struct ata_link *ata_link_next(struct ata_link *link,
1297 for ((link) = __ata_port_next_link((ap), NULL, true); (link); \ 1317 struct ata_port *ap,
1298 (link) = __ata_port_next_link((ap), (link), true)) 1318 enum ata_link_iter_mode mode);
1299 1319
1300#define ata_link_for_each_dev(dev, link) \ 1320extern struct ata_device *ata_dev_next(struct ata_device *dev,
1301 for ((dev) = (link)->device; \ 1321 struct ata_link *link,
1302 (dev) < (link)->device + ata_link_max_devices(link) || ((dev) = NULL); \ 1322 enum ata_dev_iter_mode mode);
1303 (dev)++) 1323
1324/*
1325 * Shortcut notation for iterations
1326 *
1327 * ata_for_each_link() iterates over each link of @ap according to
1328 * @mode. @link points to the current link in the loop. @link is
1329 * NULL after loop termination. ata_for_each_dev() works the same way
1330 * except that it iterates over each device of @link.
1331 *
1332 * Note that the mode prefixes ATA_{L|D}ITER_ shouldn't need to be
1333 * specified when using the following shorthand notations. Only the
1334 * mode itself (EDGE, HOST_FIRST, ENABLED, etc...) should be
1335 * specified. This not only increases brevity but also makes it
1336 * impossible to use ATA_LITER_* for device iteration or vice-versa.
1337 */
1338#define ata_for_each_link(link, ap, mode) \
1339 for ((link) = ata_link_next(NULL, (ap), ATA_LITER_##mode); (link); \
1340 (link) = ata_link_next((link), (ap), ATA_LITER_##mode))
1304 1341
1305#define ata_link_for_each_dev_reverse(dev, link) \ 1342#define ata_for_each_dev(dev, link, mode) \
1306 for ((dev) = (link)->device + ata_link_max_devices(link) - 1; \ 1343 for ((dev) = ata_dev_next(NULL, (link), ATA_DITER_##mode); (dev); \
1307 (dev) >= (link)->device || ((dev) = NULL); (dev)--) 1344 (dev) = ata_dev_next((dev), (link), ATA_DITER_##mode))
1308 1345
1309/** 1346/**
1310 * ata_ncq_enabled - Test whether NCQ is enabled 1347 * ata_ncq_enabled - Test whether NCQ is enabled
diff --git a/include/linux/linkage.h b/include/linux/linkage.h
index 9fd1f859021..fee9e59649c 100644
--- a/include/linux/linkage.h
+++ b/include/linux/linkage.h
@@ -64,14 +64,6 @@
64 name: 64 name:
65#endif 65#endif
66 66
67#define KPROBE_ENTRY(name) \
68 .pushsection .kprobes.text, "ax"; \
69 ENTRY(name)
70
71#define KPROBE_END(name) \
72 END(name); \
73 .popsection
74
75#ifndef END 67#ifndef END
76#define END(name) \ 68#define END(name) \
77 .size name, .-name 69 .size name, .-name
diff --git a/include/linux/list_nulls.h b/include/linux/list_nulls.h
new file mode 100644
index 00000000000..93150ecf3ea
--- /dev/null
+++ b/include/linux/list_nulls.h
@@ -0,0 +1,94 @@
1#ifndef _LINUX_LIST_NULLS_H
2#define _LINUX_LIST_NULLS_H
3
4/*
5 * Special version of lists, where end of list is not a NULL pointer,
6 * but a 'nulls' marker, which can have many different values.
7 * (up to 2^31 different values guaranteed on all platforms)
8 *
9 * In the standard hlist, termination of a list is the NULL pointer.
10 * In this special 'nulls' variant, we use the fact that objects stored in
11 * a list are aligned on a word (4 or 8 bytes alignment).
12 * We therefore use the last significant bit of 'ptr' :
13 * Set to 1 : This is a 'nulls' end-of-list marker (ptr >> 1)
14 * Set to 0 : This is a pointer to some object (ptr)
15 */
16
17struct hlist_nulls_head {
18 struct hlist_nulls_node *first;
19};
20
21struct hlist_nulls_node {
22 struct hlist_nulls_node *next, **pprev;
23};
24#define INIT_HLIST_NULLS_HEAD(ptr, nulls) \
25 ((ptr)->first = (struct hlist_nulls_node *) (1UL | (((long)nulls) << 1)))
26
27#define hlist_nulls_entry(ptr, type, member) container_of(ptr,type,member)
28/**
29 * ptr_is_a_nulls - Test if a ptr is a nulls
30 * @ptr: ptr to be tested
31 *
32 */
33static inline int is_a_nulls(const struct hlist_nulls_node *ptr)
34{
35 return ((unsigned long)ptr & 1);
36}
37
38/**
39 * get_nulls_value - Get the 'nulls' value of the end of chain
40 * @ptr: end of chain
41 *
42 * Should be called only if is_a_nulls(ptr);
43 */
44static inline unsigned long get_nulls_value(const struct hlist_nulls_node *ptr)
45{
46 return ((unsigned long)ptr) >> 1;
47}
48
49static inline int hlist_nulls_unhashed(const struct hlist_nulls_node *h)
50{
51 return !h->pprev;
52}
53
54static inline int hlist_nulls_empty(const struct hlist_nulls_head *h)
55{
56 return is_a_nulls(h->first);
57}
58
59static inline void __hlist_nulls_del(struct hlist_nulls_node *n)
60{
61 struct hlist_nulls_node *next = n->next;
62 struct hlist_nulls_node **pprev = n->pprev;
63 *pprev = next;
64 if (!is_a_nulls(next))
65 next->pprev = pprev;
66}
67
68/**
69 * hlist_nulls_for_each_entry - iterate over list of given type
70 * @tpos: the type * to use as a loop cursor.
71 * @pos: the &struct hlist_node to use as a loop cursor.
72 * @head: the head for your list.
73 * @member: the name of the hlist_node within the struct.
74 *
75 */
76#define hlist_nulls_for_each_entry(tpos, pos, head, member) \
77 for (pos = (head)->first; \
78 (!is_a_nulls(pos)) && \
79 ({ tpos = hlist_nulls_entry(pos, typeof(*tpos), member); 1;}); \
80 pos = pos->next)
81
82/**
83 * hlist_nulls_for_each_entry_from - iterate over a hlist continuing from current point
84 * @tpos: the type * to use as a loop cursor.
85 * @pos: the &struct hlist_node to use as a loop cursor.
86 * @member: the name of the hlist_node within the struct.
87 *
88 */
89#define hlist_nulls_for_each_entry_from(tpos, pos, member) \
90 for (; (!is_a_nulls(pos)) && \
91 ({ tpos = hlist_nulls_entry(pos, typeof(*tpos), member); 1;}); \
92 pos = pos->next)
93
94#endif
diff --git a/include/linux/lockd/bind.h b/include/linux/lockd/bind.h
index e5872dc994c..fbc48f89852 100644
--- a/include/linux/lockd/bind.h
+++ b/include/linux/lockd/bind.h
@@ -41,6 +41,7 @@ struct nlmclnt_initdata {
41 size_t addrlen; 41 size_t addrlen;
42 unsigned short protocol; 42 unsigned short protocol;
43 u32 nfs_version; 43 u32 nfs_version;
44 int noresvport;
44}; 45};
45 46
46/* 47/*
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index b56d5aa9b19..23da3fa69ef 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -49,6 +49,7 @@ struct nlm_host {
49 unsigned short h_proto; /* transport proto */ 49 unsigned short h_proto; /* transport proto */
50 unsigned short h_reclaiming : 1, 50 unsigned short h_reclaiming : 1,
51 h_server : 1, /* server side, not client side */ 51 h_server : 1, /* server side, not client side */
52 h_noresvport : 1,
52 h_inuse : 1; 53 h_inuse : 1;
53 wait_queue_head_t h_gracewait; /* wait while reclaiming */ 54 wait_queue_head_t h_gracewait; /* wait while reclaiming */
54 struct rw_semaphore h_rwsem; /* Reboot recovery lock */ 55 struct rw_semaphore h_rwsem; /* Reboot recovery lock */
@@ -220,7 +221,8 @@ struct nlm_host *nlmclnt_lookup_host(const struct sockaddr *sap,
220 const size_t salen, 221 const size_t salen,
221 const unsigned short protocol, 222 const unsigned short protocol,
222 const u32 version, 223 const u32 version,
223 const char *hostname); 224 const char *hostname,
225 int noresvport);
224struct nlm_host *nlmsvc_lookup_host(const struct svc_rqst *rqstp, 226struct nlm_host *nlmsvc_lookup_host(const struct svc_rqst *rqstp,
225 const char *hostname, 227 const char *hostname,
226 const size_t hostname_len); 228 const size_t hostname_len);
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index 8956daf64ab..23bf02fb124 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -314,8 +314,15 @@ extern void lock_acquire(struct lockdep_map *lock, unsigned int subclass,
314extern void lock_release(struct lockdep_map *lock, int nested, 314extern void lock_release(struct lockdep_map *lock, int nested,
315 unsigned long ip); 315 unsigned long ip);
316 316
317extern void lock_set_subclass(struct lockdep_map *lock, unsigned int subclass, 317extern void lock_set_class(struct lockdep_map *lock, const char *name,
318 unsigned long ip); 318 struct lock_class_key *key, unsigned int subclass,
319 unsigned long ip);
320
321static inline void lock_set_subclass(struct lockdep_map *lock,
322 unsigned int subclass, unsigned long ip)
323{
324 lock_set_class(lock, lock->name, lock->key, subclass, ip);
325}
319 326
320# define INIT_LOCKDEP .lockdep_recursion = 0, 327# define INIT_LOCKDEP .lockdep_recursion = 0,
321 328
@@ -333,6 +340,7 @@ static inline void lockdep_on(void)
333 340
334# define lock_acquire(l, s, t, r, c, n, i) do { } while (0) 341# define lock_acquire(l, s, t, r, c, n, i) do { } while (0)
335# define lock_release(l, n, i) do { } while (0) 342# define lock_release(l, n, i) do { } while (0)
343# define lock_set_class(l, n, k, s, i) do { } while (0)
336# define lock_set_subclass(l, s, i) do { } while (0) 344# define lock_set_subclass(l, s, i) do { } while (0)
337# define lockdep_init() do { } while (0) 345# define lockdep_init() do { } while (0)
338# define lockdep_info() do { } while (0) 346# define lockdep_info() do { } while (0)
@@ -382,7 +390,7 @@ do { \
382 390
383#endif /* CONFIG_LOCK_STAT */ 391#endif /* CONFIG_LOCK_STAT */
384 392
385#if defined(CONFIG_TRACE_IRQFLAGS) && defined(CONFIG_GENERIC_HARDIRQS) 393#ifdef CONFIG_GENERIC_HARDIRQS
386extern void early_init_irq_lock_class(void); 394extern void early_init_irq_lock_class(void);
387#else 395#else
388static inline void early_init_irq_lock_class(void) 396static inline void early_init_irq_lock_class(void)
diff --git a/include/linux/mdio-gpio.h b/include/linux/mdio-gpio.h
new file mode 100644
index 00000000000..e9d3fdfe41d
--- /dev/null
+++ b/include/linux/mdio-gpio.h
@@ -0,0 +1,25 @@
1/*
2 * MDIO-GPIO bus platform data structures
3 *
4 * Copyright (C) 2008, Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
5 *
6 * This file is licensed under the terms of the GNU General Public License
7 * version 2. This program is licensed "as is" without any warranty of any
8 * kind, whether express or implied.
9 */
10
11#ifndef __LINUX_MDIO_GPIO_H
12#define __LINUX_MDIO_GPIO_H
13
14#include <linux/mdio-bitbang.h>
15
16struct mdio_gpio_platform_data {
17 /* GPIO numbers for bus pins */
18 unsigned int mdc;
19 unsigned int mdio;
20
21 unsigned int phy_mask;
22 int irqs[PHY_MAX_ADDR];
23};
24
25#endif /* __LINUX_MDIO_GPIO_H */
diff --git a/include/linux/mfd/wm8350/audio.h b/include/linux/mfd/wm8350/audio.h
index 217bb22ebb8..af95a1d2f3a 100644
--- a/include/linux/mfd/wm8350/audio.h
+++ b/include/linux/mfd/wm8350/audio.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * audio.h -- Audio Driver for Wolfson WM8350 PMIC 2 * audio.h -- Audio Driver for Wolfson WM8350 PMIC
3 * 3 *
4 * Copyright 2007 Wolfson Microelectronics PLC 4 * Copyright 2007, 2008 Wolfson Microelectronics PLC
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the 7 * under the terms of the GNU General Public License as published by the
@@ -70,9 +70,9 @@
70#define WM8350_CODEC_ISEL_0_5 3 /* x0.5 */ 70#define WM8350_CODEC_ISEL_0_5 3 /* x0.5 */
71 71
72#define WM8350_VMID_OFF 0 72#define WM8350_VMID_OFF 0
73#define WM8350_VMID_500K 1 73#define WM8350_VMID_300K 1
74#define WM8350_VMID_100K 2 74#define WM8350_VMID_50K 2
75#define WM8350_VMID_10K 3 75#define WM8350_VMID_5K 3
76 76
77/* 77/*
78 * R40 (0x28) - Clock Control 1 78 * R40 (0x28) - Clock Control 1
@@ -591,8 +591,38 @@
591#define WM8350_IRQ_CODEC_MICSCD 41 591#define WM8350_IRQ_CODEC_MICSCD 41
592#define WM8350_IRQ_CODEC_MICD 42 592#define WM8350_IRQ_CODEC_MICD 42
593 593
594/*
595 * WM8350 Platform data.
596 *
597 * This must be initialised per platform for best audio performance.
598 * Please see WM8350 datasheet for information.
599 */
600struct wm8350_audio_platform_data {
601 int vmid_discharge_msecs; /* VMID --> OFF discharge time */
602 int drain_msecs; /* OFF drain time */
603 int cap_discharge_msecs; /* Cap ON (from OFF) discharge time */
604 int vmid_charge_msecs; /* vmid power up time */
605 u32 vmid_s_curve:2; /* vmid enable s curve speed */
606 u32 dis_out4:2; /* out4 discharge speed */
607 u32 dis_out3:2; /* out3 discharge speed */
608 u32 dis_out2:2; /* out2 discharge speed */
609 u32 dis_out1:2; /* out1 discharge speed */
610 u32 vroi_out4:1; /* out4 tie off */
611 u32 vroi_out3:1; /* out3 tie off */
612 u32 vroi_out2:1; /* out2 tie off */
613 u32 vroi_out1:1; /* out1 tie off */
614 u32 vroi_enable:1; /* enable tie off */
615 u32 codec_current_on:2; /* current level ON */
616 u32 codec_current_standby:2; /* current level STANDBY */
617 u32 codec_current_charge:2; /* codec current @ vmid charge */
618};
619
620struct snd_soc_codec;
621
594struct wm8350_codec { 622struct wm8350_codec {
595 struct platform_device *pdev; 623 struct platform_device *pdev;
624 struct snd_soc_codec *codec;
625 struct wm8350_audio_platform_data *platform_data;
596}; 626};
597 627
598#endif 628#endif
diff --git a/include/linux/mii.h b/include/linux/mii.h
index 151b7e0182c..ad748588faf 100644
--- a/include/linux/mii.h
+++ b/include/linux/mii.h
@@ -135,6 +135,10 @@
135#define LPA_1000FULL 0x0800 /* Link partner 1000BASE-T full duplex */ 135#define LPA_1000FULL 0x0800 /* Link partner 1000BASE-T full duplex */
136#define LPA_1000HALF 0x0400 /* Link partner 1000BASE-T half duplex */ 136#define LPA_1000HALF 0x0400 /* Link partner 1000BASE-T half duplex */
137 137
138/* Flow control flags */
139#define FLOW_CTRL_TX 0x01
140#define FLOW_CTRL_RX 0x02
141
138/* This structure is used in all SIOCxMIIxxx ioctl calls */ 142/* This structure is used in all SIOCxMIIxxx ioctl calls */
139struct mii_ioctl_data { 143struct mii_ioctl_data {
140 __u16 phy_id; 144 __u16 phy_id;
@@ -235,5 +239,34 @@ static inline unsigned int mii_duplex (unsigned int duplex_lock,
235 return 0; 239 return 0;
236} 240}
237 241
242/**
243 * mii_resolve_flowctrl_fdx
244 * @lcladv: value of MII ADVERTISE register
245 * @rmtadv: value of MII LPA register
246 *
247 * Resolve full duplex flow control as per IEEE 802.3-2005 table 28B-3
248 */
249static inline u8 mii_resolve_flowctrl_fdx(u16 lcladv, u16 rmtadv)
250{
251 u8 cap = 0;
252
253 if (lcladv & ADVERTISE_PAUSE_CAP) {
254 if (lcladv & ADVERTISE_PAUSE_ASYM) {
255 if (rmtadv & LPA_PAUSE_CAP)
256 cap = FLOW_CTRL_TX | FLOW_CTRL_RX;
257 else if (rmtadv & LPA_PAUSE_ASYM)
258 cap = FLOW_CTRL_RX;
259 } else {
260 if (rmtadv & LPA_PAUSE_CAP)
261 cap = FLOW_CTRL_TX | FLOW_CTRL_RX;
262 }
263 } else if (lcladv & ADVERTISE_PAUSE_ASYM) {
264 if ((rmtadv & LPA_PAUSE_CAP) && (rmtadv & LPA_PAUSE_ASYM))
265 cap = FLOW_CTRL_TX;
266 }
267
268 return cap;
269}
270
238#endif /* __KERNEL__ */ 271#endif /* __KERNEL__ */
239#endif /* __LINUX_MII_H__ */ 272#endif /* __LINUX_MII_H__ */
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 371086fd946..8f659cc2996 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -206,6 +206,7 @@ struct mlx4_caps {
206 int reserved_cqs; 206 int reserved_cqs;
207 int num_eqs; 207 int num_eqs;
208 int reserved_eqs; 208 int reserved_eqs;
209 int num_comp_vectors;
209 int num_mpts; 210 int num_mpts;
210 int num_mtt_segs; 211 int num_mtt_segs;
211 int fmr_reserved_mtts; 212 int fmr_reserved_mtts;
@@ -328,6 +329,7 @@ struct mlx4_cq {
328 int arm_sn; 329 int arm_sn;
329 330
330 int cqn; 331 int cqn;
332 unsigned vector;
331 333
332 atomic_t refcount; 334 atomic_t refcount;
333 struct completion free; 335 struct completion free;
@@ -437,7 +439,7 @@ void mlx4_free_hwq_res(struct mlx4_dev *mdev, struct mlx4_hwq_resources *wqres,
437 439
438int mlx4_cq_alloc(struct mlx4_dev *dev, int nent, struct mlx4_mtt *mtt, 440int mlx4_cq_alloc(struct mlx4_dev *dev, int nent, struct mlx4_mtt *mtt,
439 struct mlx4_uar *uar, u64 db_rec, struct mlx4_cq *cq, 441 struct mlx4_uar *uar, u64 db_rec, struct mlx4_cq *cq,
440 int collapsed); 442 unsigned vector, int collapsed);
441void mlx4_cq_free(struct mlx4_dev *dev, struct mlx4_cq *cq); 443void mlx4_cq_free(struct mlx4_dev *dev, struct mlx4_cq *cq);
442 444
443int mlx4_qp_reserve_range(struct mlx4_dev *dev, int cnt, int align, int *base); 445int mlx4_qp_reserve_range(struct mlx4_dev *dev, int cnt, int align, int *base);
diff --git a/include/linux/mm.h b/include/linux/mm.h
index ffee2f74341..aaa8b843be2 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -145,6 +145,23 @@ extern pgprot_t protection_map[16];
145#define FAULT_FLAG_WRITE 0x01 /* Fault was a write access */ 145#define FAULT_FLAG_WRITE 0x01 /* Fault was a write access */
146#define FAULT_FLAG_NONLINEAR 0x02 /* Fault was via a nonlinear mapping */ 146#define FAULT_FLAG_NONLINEAR 0x02 /* Fault was via a nonlinear mapping */
147 147
148/*
149 * This interface is used by x86 PAT code to identify a pfn mapping that is
150 * linear over entire vma. This is to optimize PAT code that deals with
151 * marking the physical region with a particular prot. This is not for generic
152 * mm use. Note also that this check will not work if the pfn mapping is
153 * linear for a vma starting at physical address 0. In which case PAT code
154 * falls back to slow path of reserving physical range page by page.
155 */
156static inline int is_linear_pfn_mapping(struct vm_area_struct *vma)
157{
158 return ((vma->vm_flags & VM_PFNMAP) && vma->vm_pgoff);
159}
160
161static inline int is_pfn_mapping(struct vm_area_struct *vma)
162{
163 return (vma->vm_flags & VM_PFNMAP);
164}
148 165
149/* 166/*
150 * vm_fault is filled by the the pagefault handler and passed to the vma's 167 * vm_fault is filled by the the pagefault handler and passed to the vma's
@@ -781,6 +798,8 @@ int copy_page_range(struct mm_struct *dst, struct mm_struct *src,
781 struct vm_area_struct *vma); 798 struct vm_area_struct *vma);
782void unmap_mapping_range(struct address_space *mapping, 799void unmap_mapping_range(struct address_space *mapping,
783 loff_t const holebegin, loff_t const holelen, int even_cows); 800 loff_t const holebegin, loff_t const holelen, int even_cows);
801int follow_phys(struct vm_area_struct *vma, unsigned long address,
802 unsigned int flags, unsigned long *prot, resource_size_t *phys);
784int generic_access_phys(struct vm_area_struct *vma, unsigned long addr, 803int generic_access_phys(struct vm_area_struct *vma, unsigned long addr,
785 void *buf, int len, int write); 804 void *buf, int len, int write);
786 805
@@ -1286,5 +1305,7 @@ int vmemmap_populate_basepages(struct page *start_page,
1286int vmemmap_populate(struct page *start_page, unsigned long pages, int node); 1305int vmemmap_populate(struct page *start_page, unsigned long pages, int node);
1287void vmemmap_populate_print_last(void); 1306void vmemmap_populate_print_last(void);
1288 1307
1308extern void *alloc_locked_buffer(size_t size);
1309extern void free_locked_buffer(void *buffer, size_t size);
1289#endif /* __KERNEL__ */ 1310#endif /* __KERNEL__ */
1290#endif /* _LINUX_MM_H */ 1311#endif /* _LINUX_MM_H */
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index fe825471d5a..9cfc9b627fd 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -232,8 +232,9 @@ struct mm_struct {
232 struct core_state *core_state; /* coredumping support */ 232 struct core_state *core_state; /* coredumping support */
233 233
234 /* aio bits */ 234 /* aio bits */
235 rwlock_t ioctx_list_lock; /* aio lock */ 235 spinlock_t ioctx_lock;
236 struct kioctx *ioctx_list; 236 struct hlist_head ioctx_list;
237
237#ifdef CONFIG_MM_OWNER 238#ifdef CONFIG_MM_OWNER
238 /* 239 /*
239 * "owner" points to a task that is regarded as the canonical 240 * "owner" points to a task that is regarded as the canonical
diff --git a/include/linux/mroute6.h b/include/linux/mroute6.h
index 6f4c180179e..5375faca1f7 100644
--- a/include/linux/mroute6.h
+++ b/include/linux/mroute6.h
@@ -117,6 +117,7 @@ struct sioc_mif_req6
117 117
118#include <linux/pim.h> 118#include <linux/pim.h>
119#include <linux/skbuff.h> /* for struct sk_buff_head */ 119#include <linux/skbuff.h> /* for struct sk_buff_head */
120#include <net/net_namespace.h>
120 121
121#ifdef CONFIG_IPV6_MROUTE 122#ifdef CONFIG_IPV6_MROUTE
122static inline int ip6_mroute_opt(int opt) 123static inline int ip6_mroute_opt(int opt)
@@ -187,6 +188,9 @@ struct mif_device
187struct mfc6_cache 188struct mfc6_cache
188{ 189{
189 struct mfc6_cache *next; /* Next entry on cache line */ 190 struct mfc6_cache *next; /* Next entry on cache line */
191#ifdef CONFIG_NET_NS
192 struct net *mfc6_net;
193#endif
190 struct in6_addr mf6c_mcastgrp; /* Group the entry belongs to */ 194 struct in6_addr mf6c_mcastgrp; /* Group the entry belongs to */
191 struct in6_addr mf6c_origin; /* Source of packet */ 195 struct in6_addr mf6c_origin; /* Source of packet */
192 mifi_t mf6c_parent; /* Source interface */ 196 mifi_t mf6c_parent; /* Source interface */
@@ -209,6 +213,18 @@ struct mfc6_cache
209 } mfc_un; 213 } mfc_un;
210}; 214};
211 215
216static inline
217struct net *mfc6_net(const struct mfc6_cache *mfc)
218{
219 return read_pnet(&mfc->mfc6_net);
220}
221
222static inline
223void mfc6_net_set(struct mfc6_cache *mfc, struct net *net)
224{
225 write_pnet(&mfc->mfc6_net, hold_net(net));
226}
227
212#define MFC_STATIC 1 228#define MFC_STATIC 1
213#define MFC_NOTIFY 2 229#define MFC_NOTIFY 2
214 230
@@ -229,13 +245,17 @@ struct mfc6_cache
229 245
230#ifdef __KERNEL__ 246#ifdef __KERNEL__
231struct rtmsg; 247struct rtmsg;
232extern int ip6mr_get_route(struct sk_buff *skb, struct rtmsg *rtm, int nowait); 248extern int ip6mr_get_route(struct net *net, struct sk_buff *skb,
249 struct rtmsg *rtm, int nowait);
233 250
234#ifdef CONFIG_IPV6_MROUTE 251#ifdef CONFIG_IPV6_MROUTE
235extern struct sock *mroute6_socket; 252static inline struct sock *mroute6_socket(struct net *net)
253{
254 return net->ipv6.mroute6_sk;
255}
236extern int ip6mr_sk_done(struct sock *sk); 256extern int ip6mr_sk_done(struct sock *sk);
237#else 257#else
238#define mroute6_socket NULL 258static inline struct sock *mroute6_socket(struct net *net) { return NULL; }
239static inline int ip6mr_sk_done(struct sock *sk) { return 0; } 259static inline int ip6mr_sk_done(struct sock *sk) { return 0; }
240#endif 260#endif
241#endif 261#endif
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index e26f5495289..41e1224651c 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -43,6 +43,9 @@
43 43
44#include <net/net_namespace.h> 44#include <net/net_namespace.h>
45#include <net/dsa.h> 45#include <net/dsa.h>
46#ifdef CONFIG_DCB
47#include <net/dcbnl.h>
48#endif
46 49
47struct vlan_group; 50struct vlan_group;
48struct ethtool_ops; 51struct ethtool_ops;
@@ -311,8 +314,9 @@ struct napi_struct {
311 spinlock_t poll_lock; 314 spinlock_t poll_lock;
312 int poll_owner; 315 int poll_owner;
313 struct net_device *dev; 316 struct net_device *dev;
314 struct list_head dev_list;
315#endif 317#endif
318 struct list_head dev_list;
319 struct sk_buff *gro_list;
316}; 320};
317 321
318enum 322enum
@@ -373,22 +377,8 @@ static inline int napi_reschedule(struct napi_struct *napi)
373 * 377 *
374 * Mark NAPI processing as complete. 378 * Mark NAPI processing as complete.
375 */ 379 */
376static inline void __napi_complete(struct napi_struct *n) 380extern void __napi_complete(struct napi_struct *n);
377{ 381extern void napi_complete(struct napi_struct *n);
378 BUG_ON(!test_bit(NAPI_STATE_SCHED, &n->state));
379 list_del(&n->poll_list);
380 smp_mb__before_clear_bit();
381 clear_bit(NAPI_STATE_SCHED, &n->state);
382}
383
384static inline void napi_complete(struct napi_struct *n)
385{
386 unsigned long flags;
387
388 local_irq_save(flags);
389 __napi_complete(n);
390 local_irq_restore(flags);
391}
392 382
393/** 383/**
394 * napi_disable - prevent NAPI from scheduling 384 * napi_disable - prevent NAPI from scheduling
@@ -452,6 +442,147 @@ struct netdev_queue {
452 struct Qdisc *qdisc_sleeping; 442 struct Qdisc *qdisc_sleeping;
453} ____cacheline_aligned_in_smp; 443} ____cacheline_aligned_in_smp;
454 444
445
446/*
447 * This structure defines the management hooks for network devices.
448 * The following hooks can be defined; unless noted otherwise, they are
449 * optional and can be filled with a null pointer.
450 *
451 * int (*ndo_init)(struct net_device *dev);
452 * This function is called once when network device is registered.
453 * The network device can use this to any late stage initializaton
454 * or semantic validattion. It can fail with an error code which will
455 * be propogated back to register_netdev
456 *
457 * void (*ndo_uninit)(struct net_device *dev);
458 * This function is called when device is unregistered or when registration
459 * fails. It is not called if init fails.
460 *
461 * int (*ndo_open)(struct net_device *dev);
462 * This function is called when network device transistions to the up
463 * state.
464 *
465 * int (*ndo_stop)(struct net_device *dev);
466 * This function is called when network device transistions to the down
467 * state.
468 *
469 * int (*ndo_hard_start_xmit)(struct sk_buff *skb, struct net_device *dev);
470 * Called when a packet needs to be transmitted.
471 * Must return NETDEV_TX_OK , NETDEV_TX_BUSY, or NETDEV_TX_LOCKED,
472 * Required can not be NULL.
473 *
474 * u16 (*ndo_select_queue)(struct net_device *dev, struct sk_buff *skb);
475 * Called to decide which queue to when device supports multiple
476 * transmit queues.
477 *
478 * void (*ndo_change_rx_flags)(struct net_device *dev, int flags);
479 * This function is called to allow device receiver to make
480 * changes to configuration when multicast or promiscious is enabled.
481 *
482 * void (*ndo_set_rx_mode)(struct net_device *dev);
483 * This function is called device changes address list filtering.
484 *
485 * void (*ndo_set_multicast_list)(struct net_device *dev);
486 * This function is called when the multicast address list changes.
487 *
488 * int (*ndo_set_mac_address)(struct net_device *dev, void *addr);
489 * This function is called when the Media Access Control address
490 * needs to be changed. If not this interface is not defined, the
491 * mac address can not be changed.
492 *
493 * int (*ndo_validate_addr)(struct net_device *dev);
494 * Test if Media Access Control address is valid for the device.
495 *
496 * int (*ndo_do_ioctl)(struct net_device *dev, struct ifreq *ifr, int cmd);
497 * Called when a user request an ioctl which can't be handled by
498 * the generic interface code. If not defined ioctl's return
499 * not supported error code.
500 *
501 * int (*ndo_set_config)(struct net_device *dev, struct ifmap *map);
502 * Used to set network devices bus interface parameters. This interface
503 * is retained for legacy reason, new devices should use the bus
504 * interface (PCI) for low level management.
505 *
506 * int (*ndo_change_mtu)(struct net_device *dev, int new_mtu);
507 * Called when a user wants to change the Maximum Transfer Unit
508 * of a device. If not defined, any request to change MTU will
509 * will return an error.
510 *
511 * void (*ndo_tx_timeout)(struct net_device *dev);
512 * Callback uses when the transmitter has not made any progress
513 * for dev->watchdog ticks.
514 *
515 * struct net_device_stats* (*get_stats)(struct net_device *dev);
516 * Called when a user wants to get the network device usage
517 * statistics. If not defined, the counters in dev->stats will
518 * be used.
519 *
520 * void (*ndo_vlan_rx_register)(struct net_device *dev, struct vlan_group *grp);
521 * If device support VLAN receive accleration
522 * (ie. dev->features & NETIF_F_HW_VLAN_RX), then this function is called
523 * when vlan groups for the device changes. Note: grp is NULL
524 * if no vlan's groups are being used.
525 *
526 * void (*ndo_vlan_rx_add_vid)(struct net_device *dev, unsigned short vid);
527 * If device support VLAN filtering (dev->features & NETIF_F_HW_VLAN_FILTER)
528 * this function is called when a VLAN id is registered.
529 *
530 * void (*ndo_vlan_rx_kill_vid)(struct net_device *dev, unsigned short vid);
531 * If device support VLAN filtering (dev->features & NETIF_F_HW_VLAN_FILTER)
532 * this function is called when a VLAN id is unregistered.
533 *
534 * void (*ndo_poll_controller)(struct net_device *dev);
535 */
536#define HAVE_NET_DEVICE_OPS
537struct net_device_ops {
538 int (*ndo_init)(struct net_device *dev);
539 void (*ndo_uninit)(struct net_device *dev);
540 int (*ndo_open)(struct net_device *dev);
541 int (*ndo_stop)(struct net_device *dev);
542 int (*ndo_start_xmit) (struct sk_buff *skb,
543 struct net_device *dev);
544 u16 (*ndo_select_queue)(struct net_device *dev,
545 struct sk_buff *skb);
546#define HAVE_CHANGE_RX_FLAGS
547 void (*ndo_change_rx_flags)(struct net_device *dev,
548 int flags);
549#define HAVE_SET_RX_MODE
550 void (*ndo_set_rx_mode)(struct net_device *dev);
551#define HAVE_MULTICAST
552 void (*ndo_set_multicast_list)(struct net_device *dev);
553#define HAVE_SET_MAC_ADDR
554 int (*ndo_set_mac_address)(struct net_device *dev,
555 void *addr);
556#define HAVE_VALIDATE_ADDR
557 int (*ndo_validate_addr)(struct net_device *dev);
558#define HAVE_PRIVATE_IOCTL
559 int (*ndo_do_ioctl)(struct net_device *dev,
560 struct ifreq *ifr, int cmd);
561#define HAVE_SET_CONFIG
562 int (*ndo_set_config)(struct net_device *dev,
563 struct ifmap *map);
564#define HAVE_CHANGE_MTU
565 int (*ndo_change_mtu)(struct net_device *dev,
566 int new_mtu);
567 int (*ndo_neigh_setup)(struct net_device *dev,
568 struct neigh_parms *);
569#define HAVE_TX_TIMEOUT
570 void (*ndo_tx_timeout) (struct net_device *dev);
571
572 struct net_device_stats* (*ndo_get_stats)(struct net_device *dev);
573
574 void (*ndo_vlan_rx_register)(struct net_device *dev,
575 struct vlan_group *grp);
576 void (*ndo_vlan_rx_add_vid)(struct net_device *dev,
577 unsigned short vid);
578 void (*ndo_vlan_rx_kill_vid)(struct net_device *dev,
579 unsigned short vid);
580#ifdef CONFIG_NET_POLL_CONTROLLER
581#define HAVE_NETDEV_POLL
582 void (*ndo_poll_controller)(struct net_device *dev);
583#endif
584};
585
455/* 586/*
456 * The DEVICE structure. 587 * The DEVICE structure.
457 * Actually, this whole structure is a big mistake. It mixes I/O 588 * Actually, this whole structure is a big mistake. It mixes I/O
@@ -496,14 +627,7 @@ struct net_device
496 unsigned long state; 627 unsigned long state;
497 628
498 struct list_head dev_list; 629 struct list_head dev_list;
499#ifdef CONFIG_NETPOLL
500 struct list_head napi_list; 630 struct list_head napi_list;
501#endif
502
503 /* The device initialization function. Called only once. */
504 int (*init)(struct net_device *dev);
505
506 /* ------- Fields preinitialized in Space.c finish here ------- */
507 631
508 /* Net device features */ 632 /* Net device features */
509 unsigned long features; 633 unsigned long features;
@@ -522,6 +646,7 @@ struct net_device
522#define NETIF_F_LLTX 4096 /* LockLess TX - deprecated. Please */ 646#define NETIF_F_LLTX 4096 /* LockLess TX - deprecated. Please */
523 /* do not use LLTX in new drivers */ 647 /* do not use LLTX in new drivers */
524#define NETIF_F_NETNS_LOCAL 8192 /* Does not change network namespaces */ 648#define NETIF_F_NETNS_LOCAL 8192 /* Does not change network namespaces */
649#define NETIF_F_GRO 16384 /* Generic receive offload */
525#define NETIF_F_LRO 32768 /* large receive offload */ 650#define NETIF_F_LRO 32768 /* large receive offload */
526 651
527 /* Segmentation offload features */ 652 /* Segmentation offload features */
@@ -547,15 +672,13 @@ struct net_device
547 * for all in netdev_increment_features. 672 * for all in netdev_increment_features.
548 */ 673 */
549#define NETIF_F_ONE_FOR_ALL (NETIF_F_GSO_SOFTWARE | NETIF_F_GSO_ROBUST | \ 674#define NETIF_F_ONE_FOR_ALL (NETIF_F_GSO_SOFTWARE | NETIF_F_GSO_ROBUST | \
550 NETIF_F_SG | NETIF_F_HIGHDMA | \ 675 NETIF_F_SG | NETIF_F_HIGHDMA | \
551 NETIF_F_FRAGLIST) 676 NETIF_F_FRAGLIST)
552 677
553 /* Interface index. Unique device identifier */ 678 /* Interface index. Unique device identifier */
554 int ifindex; 679 int ifindex;
555 int iflink; 680 int iflink;
556 681
557
558 struct net_device_stats* (*get_stats)(struct net_device *dev);
559 struct net_device_stats stats; 682 struct net_device_stats stats;
560 683
561#ifdef CONFIG_WIRELESS_EXT 684#ifdef CONFIG_WIRELESS_EXT
@@ -565,18 +688,13 @@ struct net_device
565 /* Instance data managed by the core of Wireless Extensions. */ 688 /* Instance data managed by the core of Wireless Extensions. */
566 struct iw_public_data * wireless_data; 689 struct iw_public_data * wireless_data;
567#endif 690#endif
691 /* Management operations */
692 const struct net_device_ops *netdev_ops;
568 const struct ethtool_ops *ethtool_ops; 693 const struct ethtool_ops *ethtool_ops;
569 694
570 /* Hardware header description */ 695 /* Hardware header description */
571 const struct header_ops *header_ops; 696 const struct header_ops *header_ops;
572 697
573 /*
574 * This marks the end of the "visible" part of the structure. All
575 * fields hereafter are internal to the system, and may change at
576 * will (read: may be cleaned up at will).
577 */
578
579
580 unsigned int flags; /* interface flags (a la BSD) */ 698 unsigned int flags; /* interface flags (a la BSD) */
581 unsigned short gflags; 699 unsigned short gflags;
582 unsigned short priv_flags; /* Like 'flags' but invisible to userspace. */ 700 unsigned short priv_flags; /* Like 'flags' but invisible to userspace. */
@@ -635,7 +753,7 @@ struct net_device
635 unsigned long last_rx; /* Time of last Rx */ 753 unsigned long last_rx; /* Time of last Rx */
636 /* Interface address info used in eth_type_trans() */ 754 /* Interface address info used in eth_type_trans() */
637 unsigned char dev_addr[MAX_ADDR_LEN]; /* hw address, (before bcast 755 unsigned char dev_addr[MAX_ADDR_LEN]; /* hw address, (before bcast
638 because most packets are unicast) */ 756 because most packets are unicast) */
639 757
640 unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */ 758 unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */
641 759
@@ -654,18 +772,12 @@ struct net_device
654/* 772/*
655 * One part is mostly used on xmit path (device) 773 * One part is mostly used on xmit path (device)
656 */ 774 */
657 void *priv; /* pointer to private data */
658 int (*hard_start_xmit) (struct sk_buff *skb,
659 struct net_device *dev);
660 /* These may be needed for future network-power-down code. */ 775 /* These may be needed for future network-power-down code. */
661 unsigned long trans_start; /* Time (in jiffies) of last Tx */ 776 unsigned long trans_start; /* Time (in jiffies) of last Tx */
662 777
663 int watchdog_timeo; /* used by dev_watchdog() */ 778 int watchdog_timeo; /* used by dev_watchdog() */
664 struct timer_list watchdog_timer; 779 struct timer_list watchdog_timer;
665 780
666/*
667 * refcnt is a very hot point, so align it on SMP
668 */
669 /* Number of references to this device */ 781 /* Number of references to this device */
670 atomic_t refcnt ____cacheline_aligned_in_smp; 782 atomic_t refcnt ____cacheline_aligned_in_smp;
671 783
@@ -684,56 +796,12 @@ struct net_device
684 NETREG_RELEASED, /* called free_netdev */ 796 NETREG_RELEASED, /* called free_netdev */
685 } reg_state; 797 } reg_state;
686 798
687 /* Called after device is detached from network. */ 799 /* Called from unregister, can be used to call free_netdev */
688 void (*uninit)(struct net_device *dev); 800 void (*destructor)(struct net_device *dev);
689 /* Called after last user reference disappears. */
690 void (*destructor)(struct net_device *dev);
691
692 /* Pointers to interface service routines. */
693 int (*open)(struct net_device *dev);
694 int (*stop)(struct net_device *dev);
695#define HAVE_NETDEV_POLL
696#define HAVE_CHANGE_RX_FLAGS
697 void (*change_rx_flags)(struct net_device *dev,
698 int flags);
699#define HAVE_SET_RX_MODE
700 void (*set_rx_mode)(struct net_device *dev);
701#define HAVE_MULTICAST
702 void (*set_multicast_list)(struct net_device *dev);
703#define HAVE_SET_MAC_ADDR
704 int (*set_mac_address)(struct net_device *dev,
705 void *addr);
706#define HAVE_VALIDATE_ADDR
707 int (*validate_addr)(struct net_device *dev);
708#define HAVE_PRIVATE_IOCTL
709 int (*do_ioctl)(struct net_device *dev,
710 struct ifreq *ifr, int cmd);
711#define HAVE_SET_CONFIG
712 int (*set_config)(struct net_device *dev,
713 struct ifmap *map);
714#define HAVE_CHANGE_MTU
715 int (*change_mtu)(struct net_device *dev, int new_mtu);
716
717#define HAVE_TX_TIMEOUT
718 void (*tx_timeout) (struct net_device *dev);
719
720 void (*vlan_rx_register)(struct net_device *dev,
721 struct vlan_group *grp);
722 void (*vlan_rx_add_vid)(struct net_device *dev,
723 unsigned short vid);
724 void (*vlan_rx_kill_vid)(struct net_device *dev,
725 unsigned short vid);
726 801
727 int (*neigh_setup)(struct net_device *dev, struct neigh_parms *);
728#ifdef CONFIG_NETPOLL 802#ifdef CONFIG_NETPOLL
729 struct netpoll_info *npinfo; 803 struct netpoll_info *npinfo;
730#endif 804#endif
731#ifdef CONFIG_NET_POLL_CONTROLLER
732 void (*poll_controller)(struct net_device *dev);
733#endif
734
735 u16 (*select_queue)(struct net_device *dev,
736 struct sk_buff *skb);
737 805
738#ifdef CONFIG_NET_NS 806#ifdef CONFIG_NET_NS
739 /* Network namespace this network device is inside */ 807 /* Network namespace this network device is inside */
@@ -764,6 +832,49 @@ struct net_device
764 /* for setting kernel sock attribute on TCP connection setup */ 832 /* for setting kernel sock attribute on TCP connection setup */
765#define GSO_MAX_SIZE 65536 833#define GSO_MAX_SIZE 65536
766 unsigned int gso_max_size; 834 unsigned int gso_max_size;
835
836#ifdef CONFIG_DCB
837 /* Data Center Bridging netlink ops */
838 struct dcbnl_rtnl_ops *dcbnl_ops;
839#endif
840
841#ifdef CONFIG_COMPAT_NET_DEV_OPS
842 struct {
843 int (*init)(struct net_device *dev);
844 void (*uninit)(struct net_device *dev);
845 int (*open)(struct net_device *dev);
846 int (*stop)(struct net_device *dev);
847 int (*hard_start_xmit) (struct sk_buff *skb,
848 struct net_device *dev);
849 u16 (*select_queue)(struct net_device *dev,
850 struct sk_buff *skb);
851 void (*change_rx_flags)(struct net_device *dev,
852 int flags);
853 void (*set_rx_mode)(struct net_device *dev);
854 void (*set_multicast_list)(struct net_device *dev);
855 int (*set_mac_address)(struct net_device *dev,
856 void *addr);
857 int (*validate_addr)(struct net_device *dev);
858 int (*do_ioctl)(struct net_device *dev,
859 struct ifreq *ifr, int cmd);
860 int (*set_config)(struct net_device *dev,
861 struct ifmap *map);
862 int (*change_mtu)(struct net_device *dev, int new_mtu);
863 int (*neigh_setup)(struct net_device *dev,
864 struct neigh_parms *);
865 void (*tx_timeout) (struct net_device *dev);
866 struct net_device_stats* (*get_stats)(struct net_device *dev);
867 void (*vlan_rx_register)(struct net_device *dev,
868 struct vlan_group *grp);
869 void (*vlan_rx_add_vid)(struct net_device *dev,
870 unsigned short vid);
871 void (*vlan_rx_kill_vid)(struct net_device *dev,
872 unsigned short vid);
873#ifdef CONFIG_NET_POLL_CONTROLLER
874 void (*poll_controller)(struct net_device *dev);
875#endif
876 };
877#endif
767}; 878};
768#define to_net_dev(d) container_of(d, struct net_device, dev) 879#define to_net_dev(d) container_of(d, struct net_device, dev)
769 880
@@ -859,22 +970,8 @@ static inline void *netdev_priv(const struct net_device *dev)
859 * netif_napi_add() must be used to initialize a napi context prior to calling 970 * netif_napi_add() must be used to initialize a napi context prior to calling
860 * *any* of the other napi related functions. 971 * *any* of the other napi related functions.
861 */ 972 */
862static inline void netif_napi_add(struct net_device *dev, 973void netif_napi_add(struct net_device *dev, struct napi_struct *napi,
863 struct napi_struct *napi, 974 int (*poll)(struct napi_struct *, int), int weight);
864 int (*poll)(struct napi_struct *, int),
865 int weight)
866{
867 INIT_LIST_HEAD(&napi->poll_list);
868 napi->poll = poll;
869 napi->weight = weight;
870#ifdef CONFIG_NETPOLL
871 napi->dev = dev;
872 list_add(&napi->dev_list, &dev->napi_list);
873 spin_lock_init(&napi->poll_lock);
874 napi->poll_owner = -1;
875#endif
876 set_bit(NAPI_STATE_SCHED, &napi->state);
877}
878 975
879/** 976/**
880 * netif_napi_del - remove a napi context 977 * netif_napi_del - remove a napi context
@@ -882,12 +979,20 @@ static inline void netif_napi_add(struct net_device *dev,
882 * 979 *
883 * netif_napi_del() removes a napi context from the network device napi list 980 * netif_napi_del() removes a napi context from the network device napi list
884 */ 981 */
885static inline void netif_napi_del(struct napi_struct *napi) 982void netif_napi_del(struct napi_struct *napi);
886{ 983
887#ifdef CONFIG_NETPOLL 984struct napi_gro_cb {
888 list_del(&napi->dev_list); 985 /* This is non-zero if the packet may be of the same flow. */
889#endif 986 int same_flow;
890} 987
988 /* This is non-zero if the packet cannot be merged with the new skb. */
989 int flush;
990
991 /* Number of segments aggregated. */
992 int count;
993};
994
995#define NAPI_GRO_CB(skb) ((struct napi_gro_cb *)(skb)->cb)
891 996
892struct packet_type { 997struct packet_type {
893 __be16 type; /* This is really htons(ether_type). */ 998 __be16 type; /* This is really htons(ether_type). */
@@ -899,6 +1004,9 @@ struct packet_type {
899 struct sk_buff *(*gso_segment)(struct sk_buff *skb, 1004 struct sk_buff *(*gso_segment)(struct sk_buff *skb,
900 int features); 1005 int features);
901 int (*gso_send_check)(struct sk_buff *skb); 1006 int (*gso_send_check)(struct sk_buff *skb);
1007 struct sk_buff **(*gro_receive)(struct sk_buff **head,
1008 struct sk_buff *skb);
1009 int (*gro_complete)(struct sk_buff *skb);
902 void *af_packet_priv; 1010 void *af_packet_priv;
903 struct list_head list; 1011 struct list_head list;
904}; 1012};
@@ -1252,6 +1360,9 @@ extern int netif_rx(struct sk_buff *skb);
1252extern int netif_rx_ni(struct sk_buff *skb); 1360extern int netif_rx_ni(struct sk_buff *skb);
1253#define HAVE_NETIF_RECEIVE_SKB 1 1361#define HAVE_NETIF_RECEIVE_SKB 1
1254extern int netif_receive_skb(struct sk_buff *skb); 1362extern int netif_receive_skb(struct sk_buff *skb);
1363extern void napi_gro_flush(struct napi_struct *napi);
1364extern int napi_gro_receive(struct napi_struct *napi,
1365 struct sk_buff *skb);
1255extern void netif_nit_deliver(struct sk_buff *skb); 1366extern void netif_nit_deliver(struct sk_buff *skb);
1256extern int dev_valid_name(const char *name); 1367extern int dev_valid_name(const char *name);
1257extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *); 1368extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *);
@@ -1444,8 +1555,7 @@ static inline u32 netif_msg_init(int debug_value, int default_msg_enable_bits)
1444} 1555}
1445 1556
1446/* Test if receive needs to be scheduled but only if up */ 1557/* Test if receive needs to be scheduled but only if up */
1447static inline int netif_rx_schedule_prep(struct net_device *dev, 1558static inline int netif_rx_schedule_prep(struct napi_struct *napi)
1448 struct napi_struct *napi)
1449{ 1559{
1450 return napi_schedule_prep(napi); 1560 return napi_schedule_prep(napi);
1451} 1561}
@@ -1453,27 +1563,24 @@ static inline int netif_rx_schedule_prep(struct net_device *dev,
1453/* Add interface to tail of rx poll list. This assumes that _prep has 1563/* Add interface to tail of rx poll list. This assumes that _prep has
1454 * already been called and returned 1. 1564 * already been called and returned 1.
1455 */ 1565 */
1456static inline void __netif_rx_schedule(struct net_device *dev, 1566static inline void __netif_rx_schedule(struct napi_struct *napi)
1457 struct napi_struct *napi)
1458{ 1567{
1459 __napi_schedule(napi); 1568 __napi_schedule(napi);
1460} 1569}
1461 1570
1462/* Try to reschedule poll. Called by irq handler. */ 1571/* Try to reschedule poll. Called by irq handler. */
1463 1572
1464static inline void netif_rx_schedule(struct net_device *dev, 1573static inline void netif_rx_schedule(struct napi_struct *napi)
1465 struct napi_struct *napi)
1466{ 1574{
1467 if (netif_rx_schedule_prep(dev, napi)) 1575 if (netif_rx_schedule_prep(napi))
1468 __netif_rx_schedule(dev, napi); 1576 __netif_rx_schedule(napi);
1469} 1577}
1470 1578
1471/* Try to reschedule poll. Called by dev->poll() after netif_rx_complete(). */ 1579/* Try to reschedule poll. Called by dev->poll() after netif_rx_complete(). */
1472static inline int netif_rx_reschedule(struct net_device *dev, 1580static inline int netif_rx_reschedule(struct napi_struct *napi)
1473 struct napi_struct *napi)
1474{ 1581{
1475 if (napi_schedule_prep(napi)) { 1582 if (napi_schedule_prep(napi)) {
1476 __netif_rx_schedule(dev, napi); 1583 __netif_rx_schedule(napi);
1477 return 1; 1584 return 1;
1478 } 1585 }
1479 return 0; 1586 return 0;
@@ -1482,8 +1589,7 @@ static inline int netif_rx_reschedule(struct net_device *dev,
1482/* same as netif_rx_complete, except that local_irq_save(flags) 1589/* same as netif_rx_complete, except that local_irq_save(flags)
1483 * has already been issued 1590 * has already been issued
1484 */ 1591 */
1485static inline void __netif_rx_complete(struct net_device *dev, 1592static inline void __netif_rx_complete(struct napi_struct *napi)
1486 struct napi_struct *napi)
1487{ 1593{
1488 __napi_complete(napi); 1594 __napi_complete(napi);
1489} 1595}
@@ -1493,20 +1599,9 @@ static inline void __netif_rx_complete(struct net_device *dev,
1493 * it completes the work. The device cannot be out of poll list at this 1599 * it completes the work. The device cannot be out of poll list at this
1494 * moment, it is BUG(). 1600 * moment, it is BUG().
1495 */ 1601 */
1496static inline void netif_rx_complete(struct net_device *dev, 1602static inline void netif_rx_complete(struct napi_struct *napi)
1497 struct napi_struct *napi)
1498{ 1603{
1499 unsigned long flags; 1604 napi_complete(napi);
1500
1501 /*
1502 * don't let napi dequeue from the cpu poll list
1503 * just in case its running on a different cpu
1504 */
1505 if (unlikely(test_bit(NAPI_STATE_NPSVC, &napi->state)))
1506 return;
1507 local_irq_save(flags);
1508 __netif_rx_complete(dev, napi);
1509 local_irq_restore(flags);
1510} 1605}
1511 1606
1512static inline void __netif_tx_lock(struct netdev_queue *txq, int cpu) 1607static inline void __netif_tx_lock(struct netdev_queue *txq, int cpu)
@@ -1683,6 +1778,8 @@ extern void netdev_features_change(struct net_device *dev);
1683/* Load a device via the kmod */ 1778/* Load a device via the kmod */
1684extern void dev_load(struct net *net, const char *name); 1779extern void dev_load(struct net *net, const char *name);
1685extern void dev_mcast_init(void); 1780extern void dev_mcast_init(void);
1781extern const struct net_device_stats *dev_get_stats(struct net_device *dev);
1782
1686extern int netdev_max_backlog; 1783extern int netdev_max_backlog;
1687extern int weight_p; 1784extern int weight_p;
1688extern int netdev_set_master(struct net_device *dev, struct net_device *master); 1785extern int netdev_set_master(struct net_device *dev, struct net_device *master);
@@ -1731,6 +1828,8 @@ static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb)
1731{ 1828{
1732 return skb_is_gso(skb) && 1829 return skb_is_gso(skb) &&
1733 (!skb_gso_ok(skb, dev->features) || 1830 (!skb_gso_ok(skb, dev->features) ||
1831 (skb_shinfo(skb)->frag_list &&
1832 !(dev->features & NETIF_F_FRAGLIST)) ||
1734 unlikely(skb->ip_summed != CHECKSUM_PARTIAL)); 1833 unlikely(skb->ip_summed != CHECKSUM_PARTIAL));
1735} 1834}
1736 1835
@@ -1749,26 +1848,31 @@ static inline int skb_bond_should_drop(struct sk_buff *skb)
1749 struct net_device *dev = skb->dev; 1848 struct net_device *dev = skb->dev;
1750 struct net_device *master = dev->master; 1849 struct net_device *master = dev->master;
1751 1850
1752 if (master && 1851 if (master) {
1753 (dev->priv_flags & IFF_SLAVE_INACTIVE)) { 1852 if (master->priv_flags & IFF_MASTER_ARPMON)
1754 if ((dev->priv_flags & IFF_SLAVE_NEEDARP) && 1853 dev->last_rx = jiffies;
1755 skb->protocol == __constant_htons(ETH_P_ARP))
1756 return 0;
1757 1854
1758 if (master->priv_flags & IFF_MASTER_ALB) { 1855 if (dev->priv_flags & IFF_SLAVE_INACTIVE) {
1759 if (skb->pkt_type != PACKET_BROADCAST && 1856 if ((dev->priv_flags & IFF_SLAVE_NEEDARP) &&
1760 skb->pkt_type != PACKET_MULTICAST) 1857 skb->protocol == __constant_htons(ETH_P_ARP))
1761 return 0; 1858 return 0;
1762 }
1763 if (master->priv_flags & IFF_MASTER_8023AD &&
1764 skb->protocol == __constant_htons(ETH_P_SLOW))
1765 return 0;
1766 1859
1767 return 1; 1860 if (master->priv_flags & IFF_MASTER_ALB) {
1861 if (skb->pkt_type != PACKET_BROADCAST &&
1862 skb->pkt_type != PACKET_MULTICAST)
1863 return 0;
1864 }
1865 if (master->priv_flags & IFF_MASTER_8023AD &&
1866 skb->protocol == __constant_htons(ETH_P_SLOW))
1867 return 0;
1868
1869 return 1;
1870 }
1768 } 1871 }
1769 return 0; 1872 return 0;
1770} 1873}
1771 1874
1875extern struct pernet_operations __net_initdata loopback_net_ops;
1772#endif /* __KERNEL__ */ 1876#endif /* __KERNEL__ */
1773 1877
1774#endif /* _LINUX_DEV_H */ 1878#endif /* _LINUX_DEV_H */
diff --git a/include/linux/netfilter/nfnetlink_conntrack.h b/include/linux/netfilter/nfnetlink_conntrack.h
index c19595c8930..29fe9ea1d34 100644
--- a/include/linux/netfilter/nfnetlink_conntrack.h
+++ b/include/linux/netfilter/nfnetlink_conntrack.h
@@ -141,6 +141,7 @@ enum ctattr_protonat {
141#define CTA_PROTONAT_MAX (__CTA_PROTONAT_MAX - 1) 141#define CTA_PROTONAT_MAX (__CTA_PROTONAT_MAX - 1)
142 142
143enum ctattr_natseq { 143enum ctattr_natseq {
144 CTA_NAT_SEQ_UNSPEC,
144 CTA_NAT_SEQ_CORRECTION_POS, 145 CTA_NAT_SEQ_CORRECTION_POS,
145 CTA_NAT_SEQ_OFFSET_BEFORE, 146 CTA_NAT_SEQ_OFFSET_BEFORE,
146 CTA_NAT_SEQ_OFFSET_AFTER, 147 CTA_NAT_SEQ_OFFSET_AFTER,
diff --git a/include/linux/netfilter_bridge/ebtables.h b/include/linux/netfilter_bridge/ebtables.h
index d45e29cd1cf..e40ddb94b1a 100644
--- a/include/linux/netfilter_bridge/ebtables.h
+++ b/include/linux/netfilter_bridge/ebtables.h
@@ -300,7 +300,8 @@ struct ebt_table
300 300
301#define EBT_ALIGN(s) (((s) + (__alignof__(struct ebt_replace)-1)) & \ 301#define EBT_ALIGN(s) (((s) + (__alignof__(struct ebt_replace)-1)) & \
302 ~(__alignof__(struct ebt_replace)-1)) 302 ~(__alignof__(struct ebt_replace)-1))
303extern int ebt_register_table(struct ebt_table *table); 303extern struct ebt_table *ebt_register_table(struct net *net,
304 struct ebt_table *table);
304extern void ebt_unregister_table(struct ebt_table *table); 305extern void ebt_unregister_table(struct ebt_table *table);
305extern unsigned int ebt_do_table(unsigned int hook, struct sk_buff *skb, 306extern unsigned int ebt_do_table(unsigned int hook, struct sk_buff *skb,
306 const struct net_device *in, const struct net_device *out, 307 const struct net_device *in, const struct net_device *out,
diff --git a/include/linux/netfilter_ipv4/ipt_policy.h b/include/linux/netfilter_ipv4/ipt_policy.h
index b9478a25530..1037fb2cd20 100644
--- a/include/linux/netfilter_ipv4/ipt_policy.h
+++ b/include/linux/netfilter_ipv4/ipt_policy.h
@@ -1,6 +1,8 @@
1#ifndef _IPT_POLICY_H 1#ifndef _IPT_POLICY_H
2#define _IPT_POLICY_H 2#define _IPT_POLICY_H
3 3
4#include <linux/netfilter/xt_policy.h>
5
4#define IPT_POLICY_MAX_ELEM XT_POLICY_MAX_ELEM 6#define IPT_POLICY_MAX_ELEM XT_POLICY_MAX_ELEM
5 7
6/* ipt_policy_flags */ 8/* ipt_policy_flags */
diff --git a/include/linux/netfilter_ipv6/ip6t_policy.h b/include/linux/netfilter_ipv6/ip6t_policy.h
index 6bab3163d2f..b1c449d7ec8 100644
--- a/include/linux/netfilter_ipv6/ip6t_policy.h
+++ b/include/linux/netfilter_ipv6/ip6t_policy.h
@@ -1,6 +1,8 @@
1#ifndef _IP6T_POLICY_H 1#ifndef _IP6T_POLICY_H
2#define _IP6T_POLICY_H 2#define _IP6T_POLICY_H
3 3
4#include <linux/netfilter/xt_policy.h>
5
4#define IP6T_POLICY_MAX_ELEM XT_POLICY_MAX_ELEM 6#define IP6T_POLICY_MAX_ELEM XT_POLICY_MAX_ELEM
5 7
6/* ip6t_policy_flags */ 8/* ip6t_policy_flags */
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 9ff1b54908f..51b09a1f46c 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -242,7 +242,8 @@ __nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags)
242 nlh->nlmsg_flags = flags; 242 nlh->nlmsg_flags = flags;
243 nlh->nlmsg_pid = pid; 243 nlh->nlmsg_pid = pid;
244 nlh->nlmsg_seq = seq; 244 nlh->nlmsg_seq = seq;
245 memset(NLMSG_DATA(nlh) + len, 0, NLMSG_ALIGN(size) - size); 245 if (!__builtin_constant_p(size) || NLMSG_ALIGN(size) - size != 0)
246 memset(NLMSG_DATA(nlh) + len, 0, NLMSG_ALIGN(size) - size);
246 return nlh; 247 return nlh;
247} 248}
248 249
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h
index e3d79593fb3..e38d3c9dccd 100644
--- a/include/linux/netpoll.h
+++ b/include/linux/netpoll.h
@@ -94,11 +94,6 @@ static inline void netpoll_poll_unlock(void *have)
94 rcu_read_unlock(); 94 rcu_read_unlock();
95} 95}
96 96
97static inline void netpoll_netdev_init(struct net_device *dev)
98{
99 INIT_LIST_HEAD(&dev->napi_list);
100}
101
102#else 97#else
103static inline int netpoll_rx(struct sk_buff *skb) 98static inline int netpoll_rx(struct sk_buff *skb)
104{ 99{
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 4eaa8347a0d..db867b04ac3 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -83,7 +83,7 @@ struct nfs_open_context {
83 struct rpc_cred *cred; 83 struct rpc_cred *cred;
84 struct nfs4_state *state; 84 struct nfs4_state *state;
85 fl_owner_t lockowner; 85 fl_owner_t lockowner;
86 int mode; 86 fmode_t mode;
87 87
88 unsigned long flags; 88 unsigned long flags;
89#define NFS_CONTEXT_ERROR_WRITE (0) 89#define NFS_CONTEXT_ERROR_WRITE (0)
@@ -130,7 +130,10 @@ struct nfs_inode {
130 * 130 *
131 * We need to revalidate the cached attrs for this inode if 131 * We need to revalidate the cached attrs for this inode if
132 * 132 *
133 * jiffies - read_cache_jiffies > attrtimeo 133 * jiffies - read_cache_jiffies >= attrtimeo
134 *
135 * Please note the comparison is greater than or equal
136 * so that zero timeout values can be specified.
134 */ 137 */
135 unsigned long read_cache_jiffies; 138 unsigned long read_cache_jiffies;
136 unsigned long attrtimeo; 139 unsigned long attrtimeo;
@@ -180,7 +183,7 @@ struct nfs_inode {
180 /* NFSv4 state */ 183 /* NFSv4 state */
181 struct list_head open_states; 184 struct list_head open_states;
182 struct nfs_delegation *delegation; 185 struct nfs_delegation *delegation;
183 int delegation_state; 186 fmode_t delegation_state;
184 struct rw_semaphore rwsem; 187 struct rw_semaphore rwsem;
185#endif /* CONFIG_NFS_V4*/ 188#endif /* CONFIG_NFS_V4*/
186 struct inode vfs_inode; 189 struct inode vfs_inode;
@@ -342,7 +345,7 @@ extern int nfs_setattr(struct dentry *, struct iattr *);
342extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr); 345extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr);
343extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx); 346extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx);
344extern void put_nfs_open_context(struct nfs_open_context *ctx); 347extern void put_nfs_open_context(struct nfs_open_context *ctx);
345extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, int mode); 348extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, fmode_t mode);
346extern u64 nfs_compat_user_ino64(u64 fileid); 349extern u64 nfs_compat_user_ino64(u64 fileid);
347extern void nfs_fattr_init(struct nfs_fattr *fattr); 350extern void nfs_fattr_init(struct nfs_fattr *fattr);
348 351
@@ -533,12 +536,6 @@ static inline void nfs3_forget_cached_acls(struct inode *inode)
533#endif /* CONFIG_NFS_V3_ACL */ 536#endif /* CONFIG_NFS_V3_ACL */
534 537
535/* 538/*
536 * linux/fs/mount_clnt.c
537 */
538extern int nfs_mount(struct sockaddr *, size_t, char *, char *,
539 int, int, struct nfs_fh *);
540
541/*
542 * inline functions 539 * inline functions
543 */ 540 */
544 541
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index 4e477ae5869..9bb81aec91c 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -42,12 +42,6 @@ struct nfs_client {
42 struct rb_root cl_openowner_id; 42 struct rb_root cl_openowner_id;
43 struct rb_root cl_lockowner_id; 43 struct rb_root cl_lockowner_id;
44 44
45 /*
46 * The following rwsem ensures exclusive access to the server
47 * while we recover the state following a lease expiration.
48 */
49 struct rw_semaphore cl_sem;
50
51 struct list_head cl_delegations; 45 struct list_head cl_delegations;
52 struct rb_root cl_state_owners; 46 struct rb_root cl_state_owners;
53 spinlock_t cl_lock; 47 spinlock_t cl_lock;
diff --git a/include/linux/nfs_mount.h b/include/linux/nfs_mount.h
index 6549a06ac16..4499016e6d0 100644
--- a/include/linux/nfs_mount.h
+++ b/include/linux/nfs_mount.h
@@ -45,7 +45,7 @@ struct nfs_mount_data {
45 char context[NFS_MAX_CONTEXT_LEN + 1]; /* 6 */ 45 char context[NFS_MAX_CONTEXT_LEN + 1]; /* 6 */
46}; 46};
47 47
48/* bits in the flags field */ 48/* bits in the flags field visible to user space */
49 49
50#define NFS_MOUNT_SOFT 0x0001 /* 1 */ 50#define NFS_MOUNT_SOFT 0x0001 /* 1 */
51#define NFS_MOUNT_INTR 0x0002 /* 1 */ /* now unused, but ABI */ 51#define NFS_MOUNT_INTR 0x0002 /* 1 */ /* now unused, but ABI */
@@ -68,5 +68,6 @@ struct nfs_mount_data {
68/* The following are for internal use only */ 68/* The following are for internal use only */
69#define NFS_MOUNT_LOOKUP_CACHE_NONEG 0x10000 69#define NFS_MOUNT_LOOKUP_CACHE_NONEG 0x10000
70#define NFS_MOUNT_LOOKUP_CACHE_NONE 0x20000 70#define NFS_MOUNT_LOOKUP_CACHE_NONE 0x20000
71#define NFS_MOUNT_NORESVPORT 0x40000
71 72
72#endif 73#endif
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index c1c31acb8a2..a550b528319 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -120,13 +120,14 @@ struct nfs_openargs {
120 const struct nfs_fh * fh; 120 const struct nfs_fh * fh;
121 struct nfs_seqid * seqid; 121 struct nfs_seqid * seqid;
122 int open_flags; 122 int open_flags;
123 fmode_t fmode;
123 __u64 clientid; 124 __u64 clientid;
124 __u64 id; 125 __u64 id;
125 union { 126 union {
126 struct iattr * attrs; /* UNCHECKED, GUARDED */ 127 struct iattr * attrs; /* UNCHECKED, GUARDED */
127 nfs4_verifier verifier; /* EXCLUSIVE */ 128 nfs4_verifier verifier; /* EXCLUSIVE */
128 nfs4_stateid delegation; /* CLAIM_DELEGATE_CUR */ 129 nfs4_stateid delegation; /* CLAIM_DELEGATE_CUR */
129 int delegation_type; /* CLAIM_PREVIOUS */ 130 fmode_t delegation_type; /* CLAIM_PREVIOUS */
130 } u; 131 } u;
131 const struct qstr * name; 132 const struct qstr * name;
132 const struct nfs_server *server; /* Needed for ID mapping */ 133 const struct nfs_server *server; /* Needed for ID mapping */
@@ -143,7 +144,7 @@ struct nfs_openres {
143 struct nfs_fattr * dir_attr; 144 struct nfs_fattr * dir_attr;
144 struct nfs_seqid * seqid; 145 struct nfs_seqid * seqid;
145 const struct nfs_server *server; 146 const struct nfs_server *server;
146 int delegation_type; 147 fmode_t delegation_type;
147 nfs4_stateid delegation; 148 nfs4_stateid delegation;
148 __u32 do_recall; 149 __u32 do_recall;
149 __u64 maxsize; 150 __u64 maxsize;
@@ -171,7 +172,7 @@ struct nfs_closeargs {
171 struct nfs_fh * fh; 172 struct nfs_fh * fh;
172 nfs4_stateid * stateid; 173 nfs4_stateid * stateid;
173 struct nfs_seqid * seqid; 174 struct nfs_seqid * seqid;
174 int open_flags; 175 fmode_t fmode;
175 const u32 * bitmask; 176 const u32 * bitmask;
176}; 177};
177 178
diff --git a/include/linux/nfsd/state.h b/include/linux/nfsd/state.h
index d0fe2e37845..128298c0362 100644
--- a/include/linux/nfsd/state.h
+++ b/include/linux/nfsd/state.h
@@ -124,6 +124,8 @@ struct nfs4_client {
124 nfs4_verifier cl_verifier; /* generated by client */ 124 nfs4_verifier cl_verifier; /* generated by client */
125 time_t cl_time; /* time of last lease renewal */ 125 time_t cl_time; /* time of last lease renewal */
126 __be32 cl_addr; /* client ipaddress */ 126 __be32 cl_addr; /* client ipaddress */
127 u32 cl_flavor; /* setclientid pseudoflavor */
128 char *cl_principal; /* setclientid principal name */
127 struct svc_cred cl_cred; /* setclientid principal */ 129 struct svc_cred cl_cred; /* setclientid principal */
128 clientid_t cl_clientid; /* generated by server */ 130 clientid_t cl_clientid; /* generated by server */
129 nfs4_verifier cl_confirm; /* generated by server */ 131 nfs4_verifier cl_confirm; /* generated by server */
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index 9bad65400fb..e86ed59f9ad 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -3,7 +3,26 @@
3/* 3/*
4 * 802.11 netlink interface public header 4 * 802.11 netlink interface public header
5 * 5 *
6 * Copyright 2006, 2007 Johannes Berg <johannes@sipsolutions.net> 6 * Copyright 2006, 2007, 2008 Johannes Berg <johannes@sipsolutions.net>
7 * Copyright 2008 Michael Wu <flamingice@sourmilk.net>
8 * Copyright 2008 Luis Carlos Cobo <luisca@cozybit.com>
9 * Copyright 2008 Michael Buesch <mb@bu3sch.de>
10 * Copyright 2008 Luis R. Rodriguez <lrodriguez@atheros.com>
11 * Copyright 2008 Jouni Malinen <jouni.malinen@atheros.com>
12 * Copyright 2008 Colin McCabe <colin@cozybit.com>
13 *
14 * Permission to use, copy, modify, and/or distribute this software for any
15 * purpose with or without fee is hereby granted, provided that the above
16 * copyright notice and this permission notice appear in all copies.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
19 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
20 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
21 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
22 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
23 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
24 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
25 *
7 */ 26 */
8 27
9/** 28/**
@@ -25,8 +44,10 @@
25 * 44 *
26 * @NL80211_CMD_GET_WIPHY: request information about a wiphy or dump request 45 * @NL80211_CMD_GET_WIPHY: request information about a wiphy or dump request
27 * to get a list of all present wiphys. 46 * to get a list of all present wiphys.
28 * @NL80211_CMD_SET_WIPHY: set wiphy name, needs %NL80211_ATTR_WIPHY and 47 * @NL80211_CMD_SET_WIPHY: set wiphy parameters, needs %NL80211_ATTR_WIPHY or
29 * %NL80211_ATTR_WIPHY_NAME. 48 * %NL80211_ATTR_IFINDEX; can be used to set %NL80211_ATTR_WIPHY_NAME,
49 * %NL80211_ATTR_WIPHY_TXQ_PARAMS, %NL80211_ATTR_WIPHY_FREQ, and/or
50 * %NL80211_ATTR_WIPHY_SEC_CHAN_OFFSET.
30 * @NL80211_CMD_NEW_WIPHY: Newly created wiphy, response to get request 51 * @NL80211_CMD_NEW_WIPHY: Newly created wiphy, response to get request
31 * or rename notification. Has attributes %NL80211_ATTR_WIPHY and 52 * or rename notification. Has attributes %NL80211_ATTR_WIPHY and
32 * %NL80211_ATTR_WIPHY_NAME. 53 * %NL80211_ATTR_WIPHY_NAME.
@@ -106,6 +127,12 @@
106 * to the the specified ISO/IEC 3166-1 alpha2 country code. The core will 127 * to the the specified ISO/IEC 3166-1 alpha2 country code. The core will
107 * store this as a valid request and then query userspace for it. 128 * store this as a valid request and then query userspace for it.
108 * 129 *
130 * @NL80211_CMD_GET_MESH_PARAMS: Get mesh networking properties for the
131 * interface identified by %NL80211_ATTR_IFINDEX
132 *
133 * @NL80211_CMD_SET_MESH_PARAMS: Set mesh networking properties for the
134 * interface identified by %NL80211_ATTR_IFINDEX
135 *
109 * @NL80211_CMD_MAX: highest used command number 136 * @NL80211_CMD_MAX: highest used command number
110 * @__NL80211_CMD_AFTER_LAST: internal use 137 * @__NL80211_CMD_AFTER_LAST: internal use
111 */ 138 */
@@ -148,6 +175,9 @@ enum nl80211_commands {
148 NL80211_CMD_SET_REG, 175 NL80211_CMD_SET_REG,
149 NL80211_CMD_REQ_SET_REG, 176 NL80211_CMD_REQ_SET_REG,
150 177
178 NL80211_CMD_GET_MESH_PARAMS,
179 NL80211_CMD_SET_MESH_PARAMS,
180
151 /* add new commands above here */ 181 /* add new commands above here */
152 182
153 /* used to define NL80211_CMD_MAX below */ 183 /* used to define NL80211_CMD_MAX below */
@@ -169,6 +199,15 @@ enum nl80211_commands {
169 * @NL80211_ATTR_WIPHY: index of wiphy to operate on, cf. 199 * @NL80211_ATTR_WIPHY: index of wiphy to operate on, cf.
170 * /sys/class/ieee80211/<phyname>/index 200 * /sys/class/ieee80211/<phyname>/index
171 * @NL80211_ATTR_WIPHY_NAME: wiphy name (used for renaming) 201 * @NL80211_ATTR_WIPHY_NAME: wiphy name (used for renaming)
202 * @NL80211_ATTR_WIPHY_TXQ_PARAMS: a nested array of TX queue parameters
203 * @NL80211_ATTR_WIPHY_FREQ: frequency of the selected channel in MHz
204 * @NL80211_ATTR_WIPHY_CHANNEL_TYPE: included with NL80211_ATTR_WIPHY_FREQ
205 * if HT20 or HT40 are allowed (i.e., 802.11n disabled if not included):
206 * NL80211_CHAN_NO_HT = HT not allowed (i.e., same as not including
207 * this attribute)
208 * NL80211_CHAN_HT20 = HT20 only
209 * NL80211_CHAN_HT40MINUS = secondary channel is below the primary channel
210 * NL80211_CHAN_HT40PLUS = secondary channel is above the primary channel
172 * 211 *
173 * @NL80211_ATTR_IFINDEX: network interface index of the device to operate on 212 * @NL80211_ATTR_IFINDEX: network interface index of the device to operate on
174 * @NL80211_ATTR_IFNAME: network interface name 213 * @NL80211_ATTR_IFNAME: network interface name
@@ -234,6 +273,9 @@ enum nl80211_commands {
234 * (u8, 0 or 1) 273 * (u8, 0 or 1)
235 * @NL80211_ATTR_BSS_SHORT_SLOT_TIME: whether short slot time enabled 274 * @NL80211_ATTR_BSS_SHORT_SLOT_TIME: whether short slot time enabled
236 * (u8, 0 or 1) 275 * (u8, 0 or 1)
276 * @NL80211_ATTR_BSS_BASIC_RATES: basic rates, array of basic
277 * rates in format defined by IEEE 802.11 7.3.2.2 but without the length
278 * restriction (at most %NL80211_MAX_SUPP_RATES).
237 * 279 *
238 * @NL80211_ATTR_HT_CAPABILITY: HT Capability information element (from 280 * @NL80211_ATTR_HT_CAPABILITY: HT Capability information element (from
239 * association request when used with NL80211_CMD_NEW_STATION) 281 * association request when used with NL80211_CMD_NEW_STATION)
@@ -296,6 +338,14 @@ enum nl80211_attrs {
296 NL80211_ATTR_REG_ALPHA2, 338 NL80211_ATTR_REG_ALPHA2,
297 NL80211_ATTR_REG_RULES, 339 NL80211_ATTR_REG_RULES,
298 340
341 NL80211_ATTR_MESH_PARAMS,
342
343 NL80211_ATTR_BSS_BASIC_RATES,
344
345 NL80211_ATTR_WIPHY_TXQ_PARAMS,
346 NL80211_ATTR_WIPHY_FREQ,
347 NL80211_ATTR_WIPHY_CHANNEL_TYPE,
348
299 /* add attributes here, update the policy in nl80211.c */ 349 /* add attributes here, update the policy in nl80211.c */
300 350
301 __NL80211_ATTR_AFTER_LAST, 351 __NL80211_ATTR_AFTER_LAST,
@@ -307,6 +357,10 @@ enum nl80211_attrs {
307 * here 357 * here
308 */ 358 */
309#define NL80211_ATTR_HT_CAPABILITY NL80211_ATTR_HT_CAPABILITY 359#define NL80211_ATTR_HT_CAPABILITY NL80211_ATTR_HT_CAPABILITY
360#define NL80211_ATTR_BSS_BASIC_RATES NL80211_ATTR_BSS_BASIC_RATES
361#define NL80211_ATTR_WIPHY_TXQ_PARAMS NL80211_ATTR_WIPHY_TXQ_PARAMS
362#define NL80211_ATTR_WIPHY_FREQ NL80211_ATTR_WIPHY_FREQ
363#define NL80211_ATTR_WIPHY_SEC_CHAN_OFFSET NL80211_ATTR_WIPHY_SEC_CHAN_OFFSET
310 364
311#define NL80211_MAX_SUPP_RATES 32 365#define NL80211_MAX_SUPP_RATES 32
312#define NL80211_MAX_SUPP_REG_RULES 32 366#define NL80211_MAX_SUPP_REG_RULES 32
@@ -371,6 +425,32 @@ enum nl80211_sta_flags {
371}; 425};
372 426
373/** 427/**
428 * enum nl80211_rate_info - bitrate information
429 *
430 * These attribute types are used with %NL80211_STA_INFO_TXRATE
431 * when getting information about the bitrate of a station.
432 *
433 * @__NL80211_RATE_INFO_INVALID: attribute number 0 is reserved
434 * @NL80211_RATE_INFO_BITRATE: total bitrate (u16, 100kbit/s)
435 * @NL80211_RATE_INFO_MCS: mcs index for 802.11n (u8)
436 * @NL80211_RATE_INFO_40_MHZ_WIDTH: 40 Mhz dualchannel bitrate
437 * @NL80211_RATE_INFO_SHORT_GI: 400ns guard interval
438 * @NL80211_RATE_INFO_MAX: highest rate_info number currently defined
439 * @__NL80211_RATE_INFO_AFTER_LAST: internal use
440 */
441enum nl80211_rate_info {
442 __NL80211_RATE_INFO_INVALID,
443 NL80211_RATE_INFO_BITRATE,
444 NL80211_RATE_INFO_MCS,
445 NL80211_RATE_INFO_40_MHZ_WIDTH,
446 NL80211_RATE_INFO_SHORT_GI,
447
448 /* keep last */
449 __NL80211_RATE_INFO_AFTER_LAST,
450 NL80211_RATE_INFO_MAX = __NL80211_RATE_INFO_AFTER_LAST - 1
451};
452
453/**
374 * enum nl80211_sta_info - station information 454 * enum nl80211_sta_info - station information
375 * 455 *
376 * These attribute types are used with %NL80211_ATTR_STA_INFO 456 * These attribute types are used with %NL80211_ATTR_STA_INFO
@@ -382,6 +462,9 @@ enum nl80211_sta_flags {
382 * @NL80211_STA_INFO_TX_BYTES: total transmitted bytes (u32, to this station) 462 * @NL80211_STA_INFO_TX_BYTES: total transmitted bytes (u32, to this station)
383 * @__NL80211_STA_INFO_AFTER_LAST: internal 463 * @__NL80211_STA_INFO_AFTER_LAST: internal
384 * @NL80211_STA_INFO_MAX: highest possible station info attribute 464 * @NL80211_STA_INFO_MAX: highest possible station info attribute
465 * @NL80211_STA_INFO_SIGNAL: signal strength of last received PPDU (u8, dBm)
466 * @NL80211_STA_INFO_TX_BITRATE: current unicast tx rate, nested attribute
467 * containing info as possible, see &enum nl80211_sta_info_txrate.
385 */ 468 */
386enum nl80211_sta_info { 469enum nl80211_sta_info {
387 __NL80211_STA_INFO_INVALID, 470 __NL80211_STA_INFO_INVALID,
@@ -391,6 +474,8 @@ enum nl80211_sta_info {
391 NL80211_STA_INFO_LLID, 474 NL80211_STA_INFO_LLID,
392 NL80211_STA_INFO_PLID, 475 NL80211_STA_INFO_PLID,
393 NL80211_STA_INFO_PLINK_STATE, 476 NL80211_STA_INFO_PLINK_STATE,
477 NL80211_STA_INFO_SIGNAL,
478 NL80211_STA_INFO_TX_BITRATE,
394 479
395 /* keep last */ 480 /* keep last */
396 __NL80211_STA_INFO_AFTER_LAST, 481 __NL80211_STA_INFO_AFTER_LAST,
@@ -452,17 +537,29 @@ enum nl80211_mpath_info {
452 * an array of nested frequency attributes 537 * an array of nested frequency attributes
453 * @NL80211_BAND_ATTR_RATES: supported bitrates in this band, 538 * @NL80211_BAND_ATTR_RATES: supported bitrates in this band,
454 * an array of nested bitrate attributes 539 * an array of nested bitrate attributes
540 * @NL80211_BAND_ATTR_HT_MCS_SET: 16-byte attribute containing the MCS set as
541 * defined in 802.11n
542 * @NL80211_BAND_ATTR_HT_CAPA: HT capabilities, as in the HT information IE
543 * @NL80211_BAND_ATTR_HT_AMPDU_FACTOR: A-MPDU factor, as in 11n
544 * @NL80211_BAND_ATTR_HT_AMPDU_DENSITY: A-MPDU density, as in 11n
455 */ 545 */
456enum nl80211_band_attr { 546enum nl80211_band_attr {
457 __NL80211_BAND_ATTR_INVALID, 547 __NL80211_BAND_ATTR_INVALID,
458 NL80211_BAND_ATTR_FREQS, 548 NL80211_BAND_ATTR_FREQS,
459 NL80211_BAND_ATTR_RATES, 549 NL80211_BAND_ATTR_RATES,
460 550
551 NL80211_BAND_ATTR_HT_MCS_SET,
552 NL80211_BAND_ATTR_HT_CAPA,
553 NL80211_BAND_ATTR_HT_AMPDU_FACTOR,
554 NL80211_BAND_ATTR_HT_AMPDU_DENSITY,
555
461 /* keep last */ 556 /* keep last */
462 __NL80211_BAND_ATTR_AFTER_LAST, 557 __NL80211_BAND_ATTR_AFTER_LAST,
463 NL80211_BAND_ATTR_MAX = __NL80211_BAND_ATTR_AFTER_LAST - 1 558 NL80211_BAND_ATTR_MAX = __NL80211_BAND_ATTR_AFTER_LAST - 1
464}; 559};
465 560
561#define NL80211_BAND_ATTR_HT_CAPA NL80211_BAND_ATTR_HT_CAPA
562
466/** 563/**
467 * enum nl80211_frequency_attr - frequency attributes 564 * enum nl80211_frequency_attr - frequency attributes
468 * @NL80211_FREQUENCY_ATTR_FREQ: Frequency in MHz 565 * @NL80211_FREQUENCY_ATTR_FREQ: Frequency in MHz
@@ -474,6 +571,8 @@ enum nl80211_band_attr {
474 * on this channel in current regulatory domain. 571 * on this channel in current regulatory domain.
475 * @NL80211_FREQUENCY_ATTR_RADAR: Radar detection is mandatory 572 * @NL80211_FREQUENCY_ATTR_RADAR: Radar detection is mandatory
476 * on this channel in current regulatory domain. 573 * on this channel in current regulatory domain.
574 * @NL80211_FREQUENCY_ATTR_MAX_TX_POWER: Maximum transmission power in mBm
575 * (100 * dBm).
477 */ 576 */
478enum nl80211_frequency_attr { 577enum nl80211_frequency_attr {
479 __NL80211_FREQUENCY_ATTR_INVALID, 578 __NL80211_FREQUENCY_ATTR_INVALID,
@@ -482,12 +581,15 @@ enum nl80211_frequency_attr {
482 NL80211_FREQUENCY_ATTR_PASSIVE_SCAN, 581 NL80211_FREQUENCY_ATTR_PASSIVE_SCAN,
483 NL80211_FREQUENCY_ATTR_NO_IBSS, 582 NL80211_FREQUENCY_ATTR_NO_IBSS,
484 NL80211_FREQUENCY_ATTR_RADAR, 583 NL80211_FREQUENCY_ATTR_RADAR,
584 NL80211_FREQUENCY_ATTR_MAX_TX_POWER,
485 585
486 /* keep last */ 586 /* keep last */
487 __NL80211_FREQUENCY_ATTR_AFTER_LAST, 587 __NL80211_FREQUENCY_ATTR_AFTER_LAST,
488 NL80211_FREQUENCY_ATTR_MAX = __NL80211_FREQUENCY_ATTR_AFTER_LAST - 1 588 NL80211_FREQUENCY_ATTR_MAX = __NL80211_FREQUENCY_ATTR_AFTER_LAST - 1
489}; 589};
490 590
591#define NL80211_FREQUENCY_ATTR_MAX_TX_POWER NL80211_FREQUENCY_ATTR_MAX_TX_POWER
592
491/** 593/**
492 * enum nl80211_bitrate_attr - bitrate attributes 594 * enum nl80211_bitrate_attr - bitrate attributes
493 * @NL80211_BITRATE_ATTR_RATE: Bitrate in units of 100 kbps 595 * @NL80211_BITRATE_ATTR_RATE: Bitrate in units of 100 kbps
@@ -594,4 +696,119 @@ enum nl80211_mntr_flags {
594 NL80211_MNTR_FLAG_MAX = __NL80211_MNTR_FLAG_AFTER_LAST - 1 696 NL80211_MNTR_FLAG_MAX = __NL80211_MNTR_FLAG_AFTER_LAST - 1
595}; 697};
596 698
699/**
700 * enum nl80211_meshconf_params - mesh configuration parameters
701 *
702 * Mesh configuration parameters
703 *
704 * @__NL80211_MESHCONF_INVALID: internal use
705 *
706 * @NL80211_MESHCONF_RETRY_TIMEOUT: specifies the initial retry timeout in
707 * millisecond units, used by the Peer Link Open message
708 *
709 * @NL80211_MESHCONF_CONFIRM_TIMEOUT: specifies the inital confirm timeout, in
710 * millisecond units, used by the peer link management to close a peer link
711 *
712 * @NL80211_MESHCONF_HOLDING_TIMEOUT: specifies the holding timeout, in
713 * millisecond units
714 *
715 * @NL80211_MESHCONF_MAX_PEER_LINKS: maximum number of peer links allowed
716 * on this mesh interface
717 *
718 * @NL80211_MESHCONF_MAX_RETRIES: specifies the maximum number of peer link
719 * open retries that can be sent to establish a new peer link instance in a
720 * mesh
721 *
722 * @NL80211_MESHCONF_TTL: specifies the value of TTL field set at a source mesh
723 * point.
724 *
725 * @NL80211_MESHCONF_AUTO_OPEN_PLINKS: whether we should automatically
726 * open peer links when we detect compatible mesh peers.
727 *
728 * @NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES: the number of action frames
729 * containing a PREQ that an MP can send to a particular destination (path
730 * target)
731 *
732 * @NL80211_MESHCONF_PATH_REFRESH_TIME: how frequently to refresh mesh paths
733 * (in milliseconds)
734 *
735 * @NL80211_MESHCONF_MIN_DISCOVERY_TIMEOUT: minimum length of time to wait
736 * until giving up on a path discovery (in milliseconds)
737 *
738 * @NL80211_MESHCONF_HWMP_ACTIVE_PATH_TIMEOUT: The time (in TUs) for which mesh
739 * points receiving a PREQ shall consider the forwarding information from the
740 * root to be valid. (TU = time unit)
741 *
742 * @NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL: The minimum interval of time (in
743 * TUs) during which an MP can send only one action frame containing a PREQ
744 * reference element
745 *
746 * @NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME: The interval of time (in TUs)
747 * that it takes for an HWMP information element to propagate across the mesh
748 *
749 * @NL80211_MESHCONF_ATTR_MAX: highest possible mesh configuration attribute
750 *
751 * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use
752 */
753enum nl80211_meshconf_params {
754 __NL80211_MESHCONF_INVALID,
755 NL80211_MESHCONF_RETRY_TIMEOUT,
756 NL80211_MESHCONF_CONFIRM_TIMEOUT,
757 NL80211_MESHCONF_HOLDING_TIMEOUT,
758 NL80211_MESHCONF_MAX_PEER_LINKS,
759 NL80211_MESHCONF_MAX_RETRIES,
760 NL80211_MESHCONF_TTL,
761 NL80211_MESHCONF_AUTO_OPEN_PLINKS,
762 NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES,
763 NL80211_MESHCONF_PATH_REFRESH_TIME,
764 NL80211_MESHCONF_MIN_DISCOVERY_TIMEOUT,
765 NL80211_MESHCONF_HWMP_ACTIVE_PATH_TIMEOUT,
766 NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL,
767 NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME,
768
769 /* keep last */
770 __NL80211_MESHCONF_ATTR_AFTER_LAST,
771 NL80211_MESHCONF_ATTR_MAX = __NL80211_MESHCONF_ATTR_AFTER_LAST - 1
772};
773
774/**
775 * enum nl80211_txq_attr - TX queue parameter attributes
776 * @__NL80211_TXQ_ATTR_INVALID: Attribute number 0 is reserved
777 * @NL80211_TXQ_ATTR_QUEUE: TX queue identifier (NL80211_TXQ_Q_*)
778 * @NL80211_TXQ_ATTR_TXOP: Maximum burst time in units of 32 usecs, 0 meaning
779 * disabled
780 * @NL80211_TXQ_ATTR_CWMIN: Minimum contention window [a value of the form
781 * 2^n-1 in the range 1..32767]
782 * @NL80211_TXQ_ATTR_CWMAX: Maximum contention window [a value of the form
783 * 2^n-1 in the range 1..32767]
784 * @NL80211_TXQ_ATTR_AIFS: Arbitration interframe space [0..255]
785 * @__NL80211_TXQ_ATTR_AFTER_LAST: Internal
786 * @NL80211_TXQ_ATTR_MAX: Maximum TXQ attribute number
787 */
788enum nl80211_txq_attr {
789 __NL80211_TXQ_ATTR_INVALID,
790 NL80211_TXQ_ATTR_QUEUE,
791 NL80211_TXQ_ATTR_TXOP,
792 NL80211_TXQ_ATTR_CWMIN,
793 NL80211_TXQ_ATTR_CWMAX,
794 NL80211_TXQ_ATTR_AIFS,
795
796 /* keep last */
797 __NL80211_TXQ_ATTR_AFTER_LAST,
798 NL80211_TXQ_ATTR_MAX = __NL80211_TXQ_ATTR_AFTER_LAST - 1
799};
800
801enum nl80211_txq_q {
802 NL80211_TXQ_Q_VO,
803 NL80211_TXQ_Q_VI,
804 NL80211_TXQ_Q_BE,
805 NL80211_TXQ_Q_BK
806};
807
808enum nl80211_channel_type {
809 NL80211_CHAN_NO_HT,
810 NL80211_CHAN_HT20,
811 NL80211_CHAN_HT40MINUS,
812 NL80211_CHAN_HT40PLUS
813};
597#endif /* __LINUX_NL80211_H */ 814#endif /* __LINUX_NL80211_H */
diff --git a/include/linux/nsproxy.h b/include/linux/nsproxy.h
index c8a768e5964..afad7dec1b3 100644
--- a/include/linux/nsproxy.h
+++ b/include/linux/nsproxy.h
@@ -27,7 +27,6 @@ struct nsproxy {
27 struct ipc_namespace *ipc_ns; 27 struct ipc_namespace *ipc_ns;
28 struct mnt_namespace *mnt_ns; 28 struct mnt_namespace *mnt_ns;
29 struct pid_namespace *pid_ns; 29 struct pid_namespace *pid_ns;
30 struct user_namespace *user_ns;
31 struct net *net_ns; 30 struct net *net_ns;
32}; 31};
33extern struct nsproxy init_nsproxy; 32extern struct nsproxy init_nsproxy;
diff --git a/include/linux/of.h b/include/linux/of.h
index e2488f5e7cb..6a7efa242f5 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -57,6 +57,12 @@ extern struct device_node *of_get_next_child(const struct device_node *node,
57 for (child = of_get_next_child(parent, NULL); child != NULL; \ 57 for (child = of_get_next_child(parent, NULL); child != NULL; \
58 child = of_get_next_child(parent, child)) 58 child = of_get_next_child(parent, child))
59 59
60extern struct device_node *of_find_node_with_property(
61 struct device_node *from, const char *prop_name);
62#define for_each_node_with_property(dn, prop_name) \
63 for (dn = of_find_node_with_property(NULL, prop_name); dn; \
64 dn = of_find_node_with_property(dn, prop_name))
65
60extern struct property *of_find_property(const struct device_node *np, 66extern struct property *of_find_property(const struct device_node *np,
61 const char *name, 67 const char *name,
62 int *lenp); 68 int *lenp);
diff --git a/include/linux/of_gpio.h b/include/linux/of_gpio.h
index 67db101d0eb..fc2472c3c25 100644
--- a/include/linux/of_gpio.h
+++ b/include/linux/of_gpio.h
@@ -14,9 +14,22 @@
14#ifndef __LINUX_OF_GPIO_H 14#ifndef __LINUX_OF_GPIO_H
15#define __LINUX_OF_GPIO_H 15#define __LINUX_OF_GPIO_H
16 16
17#include <linux/compiler.h>
18#include <linux/kernel.h>
17#include <linux/errno.h> 19#include <linux/errno.h>
18#include <linux/gpio.h> 20#include <linux/gpio.h>
19 21
22struct device_node;
23
24/*
25 * This is Linux-specific flags. By default controllers' and Linux' mapping
26 * match, but GPIO controllers are free to translate their own flags to
27 * Linux-specific in their .xlate callback. Though, 1:1 mapping is recommended.
28 */
29enum of_gpio_flags {
30 OF_GPIO_ACTIVE_LOW = 0x1,
31};
32
20#ifdef CONFIG_OF_GPIO 33#ifdef CONFIG_OF_GPIO
21 34
22/* 35/*
@@ -26,7 +39,7 @@ struct of_gpio_chip {
26 struct gpio_chip gc; 39 struct gpio_chip gc;
27 int gpio_cells; 40 int gpio_cells;
28 int (*xlate)(struct of_gpio_chip *of_gc, struct device_node *np, 41 int (*xlate)(struct of_gpio_chip *of_gc, struct device_node *np,
29 const void *gpio_spec); 42 const void *gpio_spec, enum of_gpio_flags *flags);
30}; 43};
31 44
32static inline struct of_gpio_chip *to_of_gpio_chip(struct gpio_chip *gc) 45static inline struct of_gpio_chip *to_of_gpio_chip(struct gpio_chip *gc)
@@ -50,20 +63,43 @@ static inline struct of_mm_gpio_chip *to_of_mm_gpio_chip(struct gpio_chip *gc)
50 return container_of(of_gc, struct of_mm_gpio_chip, of_gc); 63 return container_of(of_gc, struct of_mm_gpio_chip, of_gc);
51} 64}
52 65
53extern int of_get_gpio(struct device_node *np, int index); 66extern int of_get_gpio_flags(struct device_node *np, int index,
67 enum of_gpio_flags *flags);
68extern unsigned int of_gpio_count(struct device_node *np);
69
54extern int of_mm_gpiochip_add(struct device_node *np, 70extern int of_mm_gpiochip_add(struct device_node *np,
55 struct of_mm_gpio_chip *mm_gc); 71 struct of_mm_gpio_chip *mm_gc);
56extern int of_gpio_simple_xlate(struct of_gpio_chip *of_gc, 72extern int of_gpio_simple_xlate(struct of_gpio_chip *of_gc,
57 struct device_node *np, 73 struct device_node *np,
58 const void *gpio_spec); 74 const void *gpio_spec,
75 enum of_gpio_flags *flags);
59#else 76#else
60 77
61/* Drivers may not strictly depend on the GPIO support, so let them link. */ 78/* Drivers may not strictly depend on the GPIO support, so let them link. */
62static inline int of_get_gpio(struct device_node *np, int index) 79static inline int of_get_gpio_flags(struct device_node *np, int index,
80 enum of_gpio_flags *flags)
63{ 81{
64 return -ENOSYS; 82 return -ENOSYS;
65} 83}
66 84
85static inline unsigned int of_gpio_count(struct device_node *np)
86{
87 return 0;
88}
89
67#endif /* CONFIG_OF_GPIO */ 90#endif /* CONFIG_OF_GPIO */
68 91
92/**
93 * of_get_gpio - Get a GPIO number to use with GPIO API
94 * @np: device node to get GPIO from
95 * @index: index of the GPIO
96 *
97 * Returns GPIO number to use with Linux generic GPIO API, or one of the errno
98 * value on the error condition.
99 */
100static inline int of_get_gpio(struct device_node *np, int index)
101{
102 return of_get_gpio_flags(np, index, NULL);
103}
104
69#endif /* __LINUX_OF_GPIO_H */ 105#endif /* __LINUX_OF_GPIO_H */
diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
index a8efcfeea73..3d327b67d7e 100644
--- a/include/linux/of_platform.h
+++ b/include/linux/of_platform.h
@@ -26,8 +26,7 @@ extern struct bus_type of_platform_bus_type;
26 26
27/* 27/*
28 * An of_platform_driver driver is attached to a basic of_device on 28 * An of_platform_driver driver is attached to a basic of_device on
29 * the "platform bus" (of_platform_bus_type) (or ISA, EBUS and SBUS 29 * the "platform bus" (of_platform_bus_type).
30 * busses on sparc).
31 */ 30 */
32struct of_platform_driver 31struct of_platform_driver
33{ 32{
diff --git a/include/linux/oprofile.h b/include/linux/oprofile.h
index 5231861f357..1ce9fe572e5 100644
--- a/include/linux/oprofile.h
+++ b/include/linux/oprofile.h
@@ -86,8 +86,7 @@ int oprofile_arch_init(struct oprofile_operations * ops);
86void oprofile_arch_exit(void); 86void oprofile_arch_exit(void);
87 87
88/** 88/**
89 * Add a sample. This may be called from any context. Pass 89 * Add a sample. This may be called from any context.
90 * smp_processor_id() as cpu.
91 */ 90 */
92void oprofile_add_sample(struct pt_regs * const regs, unsigned long event); 91void oprofile_add_sample(struct pt_regs * const regs, unsigned long event);
93 92
diff --git a/include/linux/pci.h b/include/linux/pci.h
index feb4657bb04..03b0b8c3c81 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -134,6 +134,11 @@ enum pci_dev_flags {
134 PCI_DEV_FLAGS_NO_D3 = (__force pci_dev_flags_t) 2, 134 PCI_DEV_FLAGS_NO_D3 = (__force pci_dev_flags_t) 2,
135}; 135};
136 136
137enum pci_irq_reroute_variant {
138 INTEL_IRQ_REROUTE_VARIANT = 1,
139 MAX_IRQ_REROUTE_VARIANTS = 3
140};
141
137typedef unsigned short __bitwise pci_bus_flags_t; 142typedef unsigned short __bitwise pci_bus_flags_t;
138enum pci_bus_flags { 143enum pci_bus_flags {
139 PCI_BUS_FLAGS_NO_MSI = (__force pci_bus_flags_t) 1, 144 PCI_BUS_FLAGS_NO_MSI = (__force pci_bus_flags_t) 1,
@@ -218,6 +223,7 @@ struct pci_dev {
218 unsigned int no_msi:1; /* device may not use msi */ 223 unsigned int no_msi:1; /* device may not use msi */
219 unsigned int block_ucfg_access:1; /* userspace config space access is blocked */ 224 unsigned int block_ucfg_access:1; /* userspace config space access is blocked */
220 unsigned int broken_parity_status:1; /* Device generates false positive parity */ 225 unsigned int broken_parity_status:1; /* Device generates false positive parity */
226 unsigned int irq_reroute_variant:2; /* device needs IRQ rerouting variant */
221 unsigned int msi_enabled:1; 227 unsigned int msi_enabled:1;
222 unsigned int msix_enabled:1; 228 unsigned int msix_enabled:1;
223 unsigned int ari_enabled:1; /* ARI forwarding */ 229 unsigned int ari_enabled:1; /* ARI forwarding */
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 1800f1d6e40..b6e69445428 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -2304,6 +2304,10 @@
2304#define PCI_DEVICE_ID_INTEL_PXH_0 0x0329 2304#define PCI_DEVICE_ID_INTEL_PXH_0 0x0329
2305#define PCI_DEVICE_ID_INTEL_PXH_1 0x032A 2305#define PCI_DEVICE_ID_INTEL_PXH_1 0x032A
2306#define PCI_DEVICE_ID_INTEL_PXHV 0x032C 2306#define PCI_DEVICE_ID_INTEL_PXHV 0x032C
2307#define PCI_DEVICE_ID_INTEL_80332_0 0x0330
2308#define PCI_DEVICE_ID_INTEL_80332_1 0x0332
2309#define PCI_DEVICE_ID_INTEL_80333_0 0x0370
2310#define PCI_DEVICE_ID_INTEL_80333_1 0x0372
2307#define PCI_DEVICE_ID_INTEL_82375 0x0482 2311#define PCI_DEVICE_ID_INTEL_82375 0x0482
2308#define PCI_DEVICE_ID_INTEL_82424 0x0483 2312#define PCI_DEVICE_ID_INTEL_82424 0x0483
2309#define PCI_DEVICE_ID_INTEL_82378 0x0484 2313#define PCI_DEVICE_ID_INTEL_82378 0x0484
@@ -2376,6 +2380,7 @@
2376#define PCI_DEVICE_ID_INTEL_ESB_4 0x25a4 2380#define PCI_DEVICE_ID_INTEL_ESB_4 0x25a4
2377#define PCI_DEVICE_ID_INTEL_ESB_5 0x25a6 2381#define PCI_DEVICE_ID_INTEL_ESB_5 0x25a6
2378#define PCI_DEVICE_ID_INTEL_ESB_9 0x25ab 2382#define PCI_DEVICE_ID_INTEL_ESB_9 0x25ab
2383#define PCI_DEVICE_ID_INTEL_ESB_10 0x25ac
2379#define PCI_DEVICE_ID_INTEL_82820_HB 0x2500 2384#define PCI_DEVICE_ID_INTEL_82820_HB 0x2500
2380#define PCI_DEVICE_ID_INTEL_82820_UP_HB 0x2501 2385#define PCI_DEVICE_ID_INTEL_82820_UP_HB 0x2501
2381#define PCI_DEVICE_ID_INTEL_82850_HB 0x2530 2386#define PCI_DEVICE_ID_INTEL_82850_HB 0x2530
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 77c4ed60b98..d7e54d98869 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -467,6 +467,8 @@ int genphy_restart_aneg(struct phy_device *phydev);
467int genphy_config_aneg(struct phy_device *phydev); 467int genphy_config_aneg(struct phy_device *phydev);
468int genphy_update_link(struct phy_device *phydev); 468int genphy_update_link(struct phy_device *phydev);
469int genphy_read_status(struct phy_device *phydev); 469int genphy_read_status(struct phy_device *phydev);
470int genphy_suspend(struct phy_device *phydev);
471int genphy_resume(struct phy_device *phydev);
470void phy_driver_unregister(struct phy_driver *drv); 472void phy_driver_unregister(struct phy_driver *drv);
471int phy_driver_register(struct phy_driver *new_driver); 473int phy_driver_register(struct phy_driver *new_driver);
472void phy_prepare_link(struct phy_device *phydev, 474void phy_prepare_link(struct phy_device *phydev,
diff --git a/include/linux/pkt_cls.h b/include/linux/pkt_cls.h
index 7cf7824df77..e6aa8482ad7 100644
--- a/include/linux/pkt_cls.h
+++ b/include/linux/pkt_cls.h
@@ -394,6 +394,20 @@ enum
394 394
395#define TCA_BASIC_MAX (__TCA_BASIC_MAX - 1) 395#define TCA_BASIC_MAX (__TCA_BASIC_MAX - 1)
396 396
397
398/* Cgroup classifier */
399
400enum
401{
402 TCA_CGROUP_UNSPEC,
403 TCA_CGROUP_ACT,
404 TCA_CGROUP_POLICE,
405 TCA_CGROUP_EMATCHES,
406 __TCA_CGROUP_MAX,
407};
408
409#define TCA_CGROUP_MAX (__TCA_CGROUP_MAX - 1)
410
397/* Extended Matches */ 411/* Extended Matches */
398 412
399struct tcf_ematch_tree_hdr 413struct tcf_ematch_tree_hdr
diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h
index 5d921fa91a5..e3f133adba7 100644
--- a/include/linux/pkt_sched.h
+++ b/include/linux/pkt_sched.h
@@ -500,4 +500,20 @@ struct tc_netem_corrupt
500 500
501#define NETEM_DIST_SCALE 8192 501#define NETEM_DIST_SCALE 8192
502 502
503/* DRR */
504
505enum
506{
507 TCA_DRR_UNSPEC,
508 TCA_DRR_QUANTUM,
509 __TCA_DRR_MAX
510};
511
512#define TCA_DRR_MAX (__TCA_DRR_MAX - 1)
513
514struct tc_drr_stats
515{
516 u32 deficit;
517};
518
503#endif 519#endif
diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h
index a7c72135554..4f71bf4e628 100644
--- a/include/linux/posix-timers.h
+++ b/include/linux/posix-timers.h
@@ -45,7 +45,11 @@ struct k_itimer {
45 int it_requeue_pending; /* waiting to requeue this timer */ 45 int it_requeue_pending; /* waiting to requeue this timer */
46#define REQUEUE_PENDING 1 46#define REQUEUE_PENDING 1
47 int it_sigev_notify; /* notify word of sigevent struct */ 47 int it_sigev_notify; /* notify word of sigevent struct */
48 struct task_struct *it_process; /* process to send signal to */ 48 struct signal_struct *it_signal;
49 union {
50 struct pid *it_pid; /* pid of process to send signal to */
51 struct task_struct *it_process; /* for clock_nanosleep */
52 };
49 struct sigqueue *sigq; /* signal queue entry. */ 53 struct sigqueue *sigq; /* signal queue entry. */
50 union { 54 union {
51 struct { 55 struct {
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index 22641d5d45d..98b93ca4db0 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -94,6 +94,7 @@ extern void ptrace_notify(int exit_code);
94extern void __ptrace_link(struct task_struct *child, 94extern void __ptrace_link(struct task_struct *child,
95 struct task_struct *new_parent); 95 struct task_struct *new_parent);
96extern void __ptrace_unlink(struct task_struct *child); 96extern void __ptrace_unlink(struct task_struct *child);
97extern void ptrace_fork(struct task_struct *task, unsigned long clone_flags);
97#define PTRACE_MODE_READ 1 98#define PTRACE_MODE_READ 1
98#define PTRACE_MODE_ATTACH 2 99#define PTRACE_MODE_ATTACH 2
99/* Returns 0 on success, -errno on denial. */ 100/* Returns 0 on success, -errno on denial. */
@@ -313,6 +314,27 @@ static inline void user_enable_block_step(struct task_struct *task)
313#define arch_ptrace_stop(code, info) do { } while (0) 314#define arch_ptrace_stop(code, info) do { } while (0)
314#endif 315#endif
315 316
317#ifndef arch_ptrace_untrace
318/*
319 * Do machine-specific work before untracing child.
320 *
321 * This is called for a normal detach as well as from ptrace_exit()
322 * when the tracing task dies.
323 *
324 * Called with write_lock(&tasklist_lock) held.
325 */
326#define arch_ptrace_untrace(task) do { } while (0)
327#endif
328
329#ifndef arch_ptrace_fork
330/*
331 * Do machine-specific work to initialize a new task.
332 *
333 * This is called from copy_process().
334 */
335#define arch_ptrace_fork(child, clone_flags) do { } while (0)
336#endif
337
316extern int task_current_syscall(struct task_struct *target, long *callno, 338extern int task_current_syscall(struct task_struct *target, long *callno,
317 unsigned long args[6], unsigned int maxargs, 339 unsigned long args[6], unsigned int maxargs,
318 unsigned long *sp, unsigned long *pc); 340 unsigned long *sp, unsigned long *pc);
diff --git a/include/linux/rcuclassic.h b/include/linux/rcuclassic.h
index 301dda829e3..f3f697df1d7 100644
--- a/include/linux/rcuclassic.h
+++ b/include/linux/rcuclassic.h
@@ -59,8 +59,8 @@ struct rcu_ctrlblk {
59 int signaled; 59 int signaled;
60 60
61 spinlock_t lock ____cacheline_internodealigned_in_smp; 61 spinlock_t lock ____cacheline_internodealigned_in_smp;
62 cpumask_t cpumask; /* CPUs that need to switch in order */ 62 DECLARE_BITMAP(cpumask, NR_CPUS); /* CPUs that need to switch for */
63 /* for current batch to proceed. */ 63 /* current batch to proceed. */
64} ____cacheline_internodealigned_in_smp; 64} ____cacheline_internodealigned_in_smp;
65 65
66/* Is batch a before batch b ? */ 66/* Is batch a before batch b ? */
diff --git a/include/linux/rculist_nulls.h b/include/linux/rculist_nulls.h
new file mode 100644
index 00000000000..f9ddd03961a
--- /dev/null
+++ b/include/linux/rculist_nulls.h
@@ -0,0 +1,110 @@
1#ifndef _LINUX_RCULIST_NULLS_H
2#define _LINUX_RCULIST_NULLS_H
3
4#ifdef __KERNEL__
5
6/*
7 * RCU-protected list version
8 */
9#include <linux/list_nulls.h>
10#include <linux/rcupdate.h>
11
12/**
13 * hlist_nulls_del_init_rcu - deletes entry from hash list with re-initialization
14 * @n: the element to delete from the hash list.
15 *
16 * Note: hlist_nulls_unhashed() on the node return true after this. It is
17 * useful for RCU based read lockfree traversal if the writer side
18 * must know if the list entry is still hashed or already unhashed.
19 *
20 * In particular, it means that we can not poison the forward pointers
21 * that may still be used for walking the hash list and we can only
22 * zero the pprev pointer so list_unhashed() will return true after
23 * this.
24 *
25 * The caller must take whatever precautions are necessary (such as
26 * holding appropriate locks) to avoid racing with another
27 * list-mutation primitive, such as hlist_nulls_add_head_rcu() or
28 * hlist_nulls_del_rcu(), running on this same list. However, it is
29 * perfectly legal to run concurrently with the _rcu list-traversal
30 * primitives, such as hlist_nulls_for_each_entry_rcu().
31 */
32static inline void hlist_nulls_del_init_rcu(struct hlist_nulls_node *n)
33{
34 if (!hlist_nulls_unhashed(n)) {
35 __hlist_nulls_del(n);
36 n->pprev = NULL;
37 }
38}
39
40/**
41 * hlist_nulls_del_rcu - deletes entry from hash list without re-initialization
42 * @n: the element to delete from the hash list.
43 *
44 * Note: hlist_nulls_unhashed() on entry does not return true after this,
45 * the entry is in an undefined state. It is useful for RCU based
46 * lockfree traversal.
47 *
48 * In particular, it means that we can not poison the forward
49 * pointers that may still be used for walking the hash list.
50 *
51 * The caller must take whatever precautions are necessary
52 * (such as holding appropriate locks) to avoid racing
53 * with another list-mutation primitive, such as hlist_nulls_add_head_rcu()
54 * or hlist_nulls_del_rcu(), running on this same list.
55 * However, it is perfectly legal to run concurrently with
56 * the _rcu list-traversal primitives, such as
57 * hlist_nulls_for_each_entry().
58 */
59static inline void hlist_nulls_del_rcu(struct hlist_nulls_node *n)
60{
61 __hlist_nulls_del(n);
62 n->pprev = LIST_POISON2;
63}
64
65/**
66 * hlist_nulls_add_head_rcu
67 * @n: the element to add to the hash list.
68 * @h: the list to add to.
69 *
70 * Description:
71 * Adds the specified element to the specified hlist_nulls,
72 * while permitting racing traversals.
73 *
74 * The caller must take whatever precautions are necessary
75 * (such as holding appropriate locks) to avoid racing
76 * with another list-mutation primitive, such as hlist_nulls_add_head_rcu()
77 * or hlist_nulls_del_rcu(), running on this same list.
78 * However, it is perfectly legal to run concurrently with
79 * the _rcu list-traversal primitives, such as
80 * hlist_nulls_for_each_entry_rcu(), used to prevent memory-consistency
81 * problems on Alpha CPUs. Regardless of the type of CPU, the
82 * list-traversal primitive must be guarded by rcu_read_lock().
83 */
84static inline void hlist_nulls_add_head_rcu(struct hlist_nulls_node *n,
85 struct hlist_nulls_head *h)
86{
87 struct hlist_nulls_node *first = h->first;
88
89 n->next = first;
90 n->pprev = &h->first;
91 rcu_assign_pointer(h->first, n);
92 if (!is_a_nulls(first))
93 first->pprev = &n->next;
94}
95/**
96 * hlist_nulls_for_each_entry_rcu - iterate over rcu list of given type
97 * @tpos: the type * to use as a loop cursor.
98 * @pos: the &struct hlist_nulls_node to use as a loop cursor.
99 * @head: the head for your list.
100 * @member: the name of the hlist_nulls_node within the struct.
101 *
102 */
103#define hlist_nulls_for_each_entry_rcu(tpos, pos, head, member) \
104 for (pos = rcu_dereference((head)->first); \
105 (!is_a_nulls(pos)) && \
106 ({ tpos = hlist_nulls_entry(pos, typeof(*tpos), member); 1; }); \
107 pos = rcu_dereference(pos->next))
108
109#endif
110#endif
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 895dc9c1088..1168fbcea8d 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -52,11 +52,15 @@ struct rcu_head {
52 void (*func)(struct rcu_head *head); 52 void (*func)(struct rcu_head *head);
53}; 53};
54 54
55#ifdef CONFIG_CLASSIC_RCU 55#if defined(CONFIG_CLASSIC_RCU)
56#include <linux/rcuclassic.h> 56#include <linux/rcuclassic.h>
57#else /* #ifdef CONFIG_CLASSIC_RCU */ 57#elif defined(CONFIG_TREE_RCU)
58#include <linux/rcutree.h>
59#elif defined(CONFIG_PREEMPT_RCU)
58#include <linux/rcupreempt.h> 60#include <linux/rcupreempt.h>
59#endif /* #else #ifdef CONFIG_CLASSIC_RCU */ 61#else
62#error "Unknown RCU implementation specified to kernel configuration"
63#endif /* #else #if defined(CONFIG_CLASSIC_RCU) */
60 64
61#define RCU_HEAD_INIT { .next = NULL, .func = NULL } 65#define RCU_HEAD_INIT { .next = NULL, .func = NULL }
62#define RCU_HEAD(head) struct rcu_head head = RCU_HEAD_INIT 66#define RCU_HEAD(head) struct rcu_head head = RCU_HEAD_INIT
diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h
new file mode 100644
index 00000000000..d4368b7975c
--- /dev/null
+++ b/include/linux/rcutree.h
@@ -0,0 +1,329 @@
1/*
2 * Read-Copy Update mechanism for mutual exclusion (tree-based version)
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
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 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 *
18 * Copyright IBM Corporation, 2008
19 *
20 * Author: Dipankar Sarma <dipankar@in.ibm.com>
21 * Paul E. McKenney <paulmck@linux.vnet.ibm.com> Hierarchical algorithm
22 *
23 * Based on the original work by Paul McKenney <paulmck@us.ibm.com>
24 * and inputs from Rusty Russell, Andrea Arcangeli and Andi Kleen.
25 *
26 * For detailed explanation of Read-Copy Update mechanism see -
27 * Documentation/RCU
28 */
29
30#ifndef __LINUX_RCUTREE_H
31#define __LINUX_RCUTREE_H
32
33#include <linux/cache.h>
34#include <linux/spinlock.h>
35#include <linux/threads.h>
36#include <linux/percpu.h>
37#include <linux/cpumask.h>
38#include <linux/seqlock.h>
39
40/*
41 * Define shape of hierarchy based on NR_CPUS and CONFIG_RCU_FANOUT.
42 * In theory, it should be possible to add more levels straightforwardly.
43 * In practice, this has not been tested, so there is probably some
44 * bug somewhere.
45 */
46#define MAX_RCU_LVLS 3
47#define RCU_FANOUT (CONFIG_RCU_FANOUT)
48#define RCU_FANOUT_SQ (RCU_FANOUT * RCU_FANOUT)
49#define RCU_FANOUT_CUBE (RCU_FANOUT_SQ * RCU_FANOUT)
50
51#if NR_CPUS <= RCU_FANOUT
52# define NUM_RCU_LVLS 1
53# define NUM_RCU_LVL_0 1
54# define NUM_RCU_LVL_1 (NR_CPUS)
55# define NUM_RCU_LVL_2 0
56# define NUM_RCU_LVL_3 0
57#elif NR_CPUS <= RCU_FANOUT_SQ
58# define NUM_RCU_LVLS 2
59# define NUM_RCU_LVL_0 1
60# define NUM_RCU_LVL_1 (((NR_CPUS) + RCU_FANOUT - 1) / RCU_FANOUT)
61# define NUM_RCU_LVL_2 (NR_CPUS)
62# define NUM_RCU_LVL_3 0
63#elif NR_CPUS <= RCU_FANOUT_CUBE
64# define NUM_RCU_LVLS 3
65# define NUM_RCU_LVL_0 1
66# define NUM_RCU_LVL_1 (((NR_CPUS) + RCU_FANOUT_SQ - 1) / RCU_FANOUT_SQ)
67# define NUM_RCU_LVL_2 (((NR_CPUS) + (RCU_FANOUT) - 1) / (RCU_FANOUT))
68# define NUM_RCU_LVL_3 NR_CPUS
69#else
70# error "CONFIG_RCU_FANOUT insufficient for NR_CPUS"
71#endif /* #if (NR_CPUS) <= RCU_FANOUT */
72
73#define RCU_SUM (NUM_RCU_LVL_0 + NUM_RCU_LVL_1 + NUM_RCU_LVL_2 + NUM_RCU_LVL_3)
74#define NUM_RCU_NODES (RCU_SUM - NR_CPUS)
75
76/*
77 * Dynticks per-CPU state.
78 */
79struct rcu_dynticks {
80 int dynticks_nesting; /* Track nesting level, sort of. */
81 int dynticks; /* Even value for dynticks-idle, else odd. */
82 int dynticks_nmi; /* Even value for either dynticks-idle or */
83 /* not in nmi handler, else odd. So this */
84 /* remains even for nmi from irq handler. */
85};
86
87/*
88 * Definition for node within the RCU grace-period-detection hierarchy.
89 */
90struct rcu_node {
91 spinlock_t lock;
92 unsigned long qsmask; /* CPUs or groups that need to switch in */
93 /* order for current grace period to proceed.*/
94 unsigned long qsmaskinit;
95 /* Per-GP initialization for qsmask. */
96 unsigned long grpmask; /* Mask to apply to parent qsmask. */
97 int grplo; /* lowest-numbered CPU or group here. */
98 int grphi; /* highest-numbered CPU or group here. */
99 u8 grpnum; /* CPU/group number for next level up. */
100 u8 level; /* root is at level 0. */
101 struct rcu_node *parent;
102} ____cacheline_internodealigned_in_smp;
103
104/* Index values for nxttail array in struct rcu_data. */
105#define RCU_DONE_TAIL 0 /* Also RCU_WAIT head. */
106#define RCU_WAIT_TAIL 1 /* Also RCU_NEXT_READY head. */
107#define RCU_NEXT_READY_TAIL 2 /* Also RCU_NEXT head. */
108#define RCU_NEXT_TAIL 3
109#define RCU_NEXT_SIZE 4
110
111/* Per-CPU data for read-copy update. */
112struct rcu_data {
113 /* 1) quiescent-state and grace-period handling : */
114 long completed; /* Track rsp->completed gp number */
115 /* in order to detect GP end. */
116 long gpnum; /* Highest gp number that this CPU */
117 /* is aware of having started. */
118 long passed_quiesc_completed;
119 /* Value of completed at time of qs. */
120 bool passed_quiesc; /* User-mode/idle loop etc. */
121 bool qs_pending; /* Core waits for quiesc state. */
122 bool beenonline; /* CPU online at least once. */
123 struct rcu_node *mynode; /* This CPU's leaf of hierarchy */
124 unsigned long grpmask; /* Mask to apply to leaf qsmask. */
125
126 /* 2) batch handling */
127 /*
128 * If nxtlist is not NULL, it is partitioned as follows.
129 * Any of the partitions might be empty, in which case the
130 * pointer to that partition will be equal to the pointer for
131 * the following partition. When the list is empty, all of
132 * the nxttail elements point to nxtlist, which is NULL.
133 *
134 * [*nxttail[RCU_NEXT_READY_TAIL], NULL = *nxttail[RCU_NEXT_TAIL]):
135 * Entries that might have arrived after current GP ended
136 * [*nxttail[RCU_WAIT_TAIL], *nxttail[RCU_NEXT_READY_TAIL]):
137 * Entries known to have arrived before current GP ended
138 * [*nxttail[RCU_DONE_TAIL], *nxttail[RCU_WAIT_TAIL]):
139 * Entries that batch # <= ->completed - 1: waiting for current GP
140 * [nxtlist, *nxttail[RCU_DONE_TAIL]):
141 * Entries that batch # <= ->completed
142 * The grace period for these entries has completed, and
143 * the other grace-period-completed entries may be moved
144 * here temporarily in rcu_process_callbacks().
145 */
146 struct rcu_head *nxtlist;
147 struct rcu_head **nxttail[RCU_NEXT_SIZE];
148 long qlen; /* # of queued callbacks */
149 long blimit; /* Upper limit on a processed batch */
150
151#ifdef CONFIG_NO_HZ
152 /* 3) dynticks interface. */
153 struct rcu_dynticks *dynticks; /* Shared per-CPU dynticks state. */
154 int dynticks_snap; /* Per-GP tracking for dynticks. */
155 int dynticks_nmi_snap; /* Per-GP tracking for dynticks_nmi. */
156#endif /* #ifdef CONFIG_NO_HZ */
157
158 /* 4) reasons this CPU needed to be kicked by force_quiescent_state */
159#ifdef CONFIG_NO_HZ
160 unsigned long dynticks_fqs; /* Kicked due to dynticks idle. */
161#endif /* #ifdef CONFIG_NO_HZ */
162 unsigned long offline_fqs; /* Kicked due to being offline. */
163 unsigned long resched_ipi; /* Sent a resched IPI. */
164
165 /* 5) state to allow this CPU to force_quiescent_state on others */
166 long n_rcu_pending; /* rcu_pending() calls since boot. */
167 long n_rcu_pending_force_qs; /* when to force quiescent states. */
168
169 int cpu;
170};
171
172/* Values for signaled field in struct rcu_state. */
173#define RCU_GP_INIT 0 /* Grace period being initialized. */
174#define RCU_SAVE_DYNTICK 1 /* Need to scan dyntick state. */
175#define RCU_FORCE_QS 2 /* Need to force quiescent state. */
176#ifdef CONFIG_NO_HZ
177#define RCU_SIGNAL_INIT RCU_SAVE_DYNTICK
178#else /* #ifdef CONFIG_NO_HZ */
179#define RCU_SIGNAL_INIT RCU_FORCE_QS
180#endif /* #else #ifdef CONFIG_NO_HZ */
181
182#define RCU_JIFFIES_TILL_FORCE_QS 3 /* for rsp->jiffies_force_qs */
183#ifdef CONFIG_RCU_CPU_STALL_DETECTOR
184#define RCU_SECONDS_TILL_STALL_CHECK (10 * HZ) /* for rsp->jiffies_stall */
185#define RCU_SECONDS_TILL_STALL_RECHECK (30 * HZ) /* for rsp->jiffies_stall */
186#define RCU_STALL_RAT_DELAY 2 /* Allow other CPUs time */
187 /* to take at least one */
188 /* scheduling clock irq */
189 /* before ratting on them. */
190
191#endif /* #ifdef CONFIG_RCU_CPU_STALL_DETECTOR */
192
193/*
194 * RCU global state, including node hierarchy. This hierarchy is
195 * represented in "heap" form in a dense array. The root (first level)
196 * of the hierarchy is in ->node[0] (referenced by ->level[0]), the second
197 * level in ->node[1] through ->node[m] (->node[1] referenced by ->level[1]),
198 * and the third level in ->node[m+1] and following (->node[m+1] referenced
199 * by ->level[2]). The number of levels is determined by the number of
200 * CPUs and by CONFIG_RCU_FANOUT. Small systems will have a "hierarchy"
201 * consisting of a single rcu_node.
202 */
203struct rcu_state {
204 struct rcu_node node[NUM_RCU_NODES]; /* Hierarchy. */
205 struct rcu_node *level[NUM_RCU_LVLS]; /* Hierarchy levels. */
206 u32 levelcnt[MAX_RCU_LVLS + 1]; /* # nodes in each level. */
207 u8 levelspread[NUM_RCU_LVLS]; /* kids/node in each level. */
208 struct rcu_data *rda[NR_CPUS]; /* array of rdp pointers. */
209
210 /* The following fields are guarded by the root rcu_node's lock. */
211
212 u8 signaled ____cacheline_internodealigned_in_smp;
213 /* Force QS state. */
214 long gpnum; /* Current gp number. */
215 long completed; /* # of last completed gp. */
216 spinlock_t onofflock; /* exclude on/offline and */
217 /* starting new GP. */
218 spinlock_t fqslock; /* Only one task forcing */
219 /* quiescent states. */
220 unsigned long jiffies_force_qs; /* Time at which to invoke */
221 /* force_quiescent_state(). */
222 unsigned long n_force_qs; /* Number of calls to */
223 /* force_quiescent_state(). */
224 unsigned long n_force_qs_lh; /* ~Number of calls leaving */
225 /* due to lock unavailable. */
226 unsigned long n_force_qs_ngp; /* Number of calls leaving */
227 /* due to no GP active. */
228#ifdef CONFIG_RCU_CPU_STALL_DETECTOR
229 unsigned long gp_start; /* Time at which GP started, */
230 /* but in jiffies. */
231 unsigned long jiffies_stall; /* Time at which to check */
232 /* for CPU stalls. */
233#endif /* #ifdef CONFIG_RCU_CPU_STALL_DETECTOR */
234#ifdef CONFIG_NO_HZ
235 long dynticks_completed; /* Value of completed @ snap. */
236#endif /* #ifdef CONFIG_NO_HZ */
237};
238
239extern struct rcu_state rcu_state;
240DECLARE_PER_CPU(struct rcu_data, rcu_data);
241
242extern struct rcu_state rcu_bh_state;
243DECLARE_PER_CPU(struct rcu_data, rcu_bh_data);
244
245/*
246 * Increment the quiescent state counter.
247 * The counter is a bit degenerated: We do not need to know
248 * how many quiescent states passed, just if there was at least
249 * one since the start of the grace period. Thus just a flag.
250 */
251static inline void rcu_qsctr_inc(int cpu)
252{
253 struct rcu_data *rdp = &per_cpu(rcu_data, cpu);
254 rdp->passed_quiesc = 1;
255 rdp->passed_quiesc_completed = rdp->completed;
256}
257static inline void rcu_bh_qsctr_inc(int cpu)
258{
259 struct rcu_data *rdp = &per_cpu(rcu_bh_data, cpu);
260 rdp->passed_quiesc = 1;
261 rdp->passed_quiesc_completed = rdp->completed;
262}
263
264extern int rcu_pending(int cpu);
265extern int rcu_needs_cpu(int cpu);
266
267#ifdef CONFIG_DEBUG_LOCK_ALLOC
268extern struct lockdep_map rcu_lock_map;
269# define rcu_read_acquire() \
270 lock_acquire(&rcu_lock_map, 0, 0, 2, 1, NULL, _THIS_IP_)
271# define rcu_read_release() lock_release(&rcu_lock_map, 1, _THIS_IP_)
272#else
273# define rcu_read_acquire() do { } while (0)
274# define rcu_read_release() do { } while (0)
275#endif
276
277static inline void __rcu_read_lock(void)
278{
279 preempt_disable();
280 __acquire(RCU);
281 rcu_read_acquire();
282}
283static inline void __rcu_read_unlock(void)
284{
285 rcu_read_release();
286 __release(RCU);
287 preempt_enable();
288}
289static inline void __rcu_read_lock_bh(void)
290{
291 local_bh_disable();
292 __acquire(RCU_BH);
293 rcu_read_acquire();
294}
295static inline void __rcu_read_unlock_bh(void)
296{
297 rcu_read_release();
298 __release(RCU_BH);
299 local_bh_enable();
300}
301
302#define __synchronize_sched() synchronize_rcu()
303
304#define call_rcu_sched(head, func) call_rcu(head, func)
305
306static inline void rcu_init_sched(void)
307{
308}
309
310extern void __rcu_init(void);
311extern void rcu_check_callbacks(int cpu, int user);
312extern void rcu_restart_cpu(int cpu);
313
314extern long rcu_batches_completed(void);
315extern long rcu_batches_completed_bh(void);
316
317#ifdef CONFIG_NO_HZ
318void rcu_enter_nohz(void);
319void rcu_exit_nohz(void);
320#else /* CONFIG_NO_HZ */
321static inline void rcu_enter_nohz(void)
322{
323}
324static inline void rcu_exit_nohz(void)
325{
326}
327#endif /* CONFIG_NO_HZ */
328
329#endif /* __LINUX_RCUTREE_H */
diff --git a/include/linux/rfkill.h b/include/linux/rfkill.h
index 4cd64b0d982..164332cbb77 100644
--- a/include/linux/rfkill.h
+++ b/include/linux/rfkill.h
@@ -108,6 +108,7 @@ struct rfkill {
108 108
109 struct device dev; 109 struct device dev;
110 struct list_head node; 110 struct list_head node;
111 enum rfkill_state state_for_resume;
111}; 112};
112#define to_rfkill(d) container_of(d, struct rfkill, dev) 113#define to_rfkill(d) container_of(d, struct rfkill, dev)
113 114
@@ -148,11 +149,4 @@ static inline char *rfkill_get_led_name(struct rfkill *rfkill)
148#endif 149#endif
149} 150}
150 151
151/* rfkill notification chain */
152#define RFKILL_STATE_CHANGED 0x0001 /* state of a normal rfkill
153 switch has changed */
154
155int register_rfkill_notifier(struct notifier_block *nb);
156int unregister_rfkill_notifier(struct notifier_block *nb);
157
158#endif /* RFKILL_H */ 152#endif /* RFKILL_H */
diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h
index d363467c8f1..b3b35966008 100644
--- a/include/linux/ring_buffer.h
+++ b/include/linux/ring_buffer.h
@@ -118,6 +118,8 @@ void ring_buffer_record_enable_cpu(struct ring_buffer *buffer, int cpu);
118 118
119unsigned long ring_buffer_entries(struct ring_buffer *buffer); 119unsigned long ring_buffer_entries(struct ring_buffer *buffer);
120unsigned long ring_buffer_overruns(struct ring_buffer *buffer); 120unsigned long ring_buffer_overruns(struct ring_buffer *buffer);
121unsigned long ring_buffer_entries_cpu(struct ring_buffer *buffer, int cpu);
122unsigned long ring_buffer_overrun_cpu(struct ring_buffer *buffer, int cpu);
121 123
122u64 ring_buffer_time_stamp(int cpu); 124u64 ring_buffer_time_stamp(int cpu);
123void ring_buffer_normalize_time_stamp(int cpu, u64 *ts); 125void ring_buffer_normalize_time_stamp(int cpu, u64 *ts);
diff --git a/include/linux/rio_drv.h b/include/linux/rio_drv.h
index 90987b7bcc1..32c0547ffaf 100644
--- a/include/linux/rio_drv.h
+++ b/include/linux/rio_drv.h
@@ -427,9 +427,9 @@ void rio_dev_put(struct rio_dev *);
427 * Get the unique RIO device identifier. Returns the device 427 * Get the unique RIO device identifier. Returns the device
428 * identifier string. 428 * identifier string.
429 */ 429 */
430static inline char *rio_name(struct rio_dev *rdev) 430static inline const char *rio_name(struct rio_dev *rdev)
431{ 431{
432 return rdev->dev.bus_id; 432 return dev_name(&rdev->dev);
433} 433}
434 434
435/** 435/**
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 2b3d51c6ec9..e88f7058b3a 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -107,6 +107,11 @@ enum {
107 RTM_GETADDRLABEL, 107 RTM_GETADDRLABEL,
108#define RTM_GETADDRLABEL RTM_GETADDRLABEL 108#define RTM_GETADDRLABEL RTM_GETADDRLABEL
109 109
110 RTM_GETDCB = 78,
111#define RTM_GETDCB RTM_GETDCB
112 RTM_SETDCB,
113#define RTM_SETDCB RTM_SETDCB
114
110 __RTM_MAX, 115 __RTM_MAX,
111#define RTM_MAX (((__RTM_MAX + 3) & ~3) - 1) 116#define RTM_MAX (((__RTM_MAX + 3) & ~3) - 1)
112}; 117};
diff --git a/include/linux/sched.h b/include/linux/sched.h
index e5f928a079e..158d53d0776 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -571,12 +571,6 @@ struct signal_struct {
571 */ 571 */
572 struct rlimit rlim[RLIM_NLIMITS]; 572 struct rlimit rlim[RLIM_NLIMITS];
573 573
574 /* keep the process-shared keyrings here so that they do the right
575 * thing in threads created with CLONE_THREAD */
576#ifdef CONFIG_KEYS
577 struct key *session_keyring; /* keyring inherited over fork */
578 struct key *process_keyring; /* keyring private to this process */
579#endif
580#ifdef CONFIG_BSD_PROCESS_ACCT 574#ifdef CONFIG_BSD_PROCESS_ACCT
581 struct pacct_struct pacct; /* per-process accounting information */ 575 struct pacct_struct pacct; /* per-process accounting information */
582#endif 576#endif
@@ -647,6 +641,7 @@ struct user_struct {
647 /* Hash table maintenance information */ 641 /* Hash table maintenance information */
648 struct hlist_node uidhash_node; 642 struct hlist_node uidhash_node;
649 uid_t uid; 643 uid_t uid;
644 struct user_namespace *user_ns;
650 645
651#ifdef CONFIG_USER_SCHED 646#ifdef CONFIG_USER_SCHED
652 struct task_group *tg; 647 struct task_group *tg;
@@ -664,6 +659,7 @@ extern struct user_struct *find_user(uid_t);
664extern struct user_struct root_user; 659extern struct user_struct root_user;
665#define INIT_USER (&root_user) 660#define INIT_USER (&root_user)
666 661
662
667struct backing_dev_info; 663struct backing_dev_info;
668struct reclaim_state; 664struct reclaim_state;
669 665
@@ -671,8 +667,7 @@ struct reclaim_state;
671struct sched_info { 667struct sched_info {
672 /* cumulative counters */ 668 /* cumulative counters */
673 unsigned long pcount; /* # of times run on this cpu */ 669 unsigned long pcount; /* # of times run on this cpu */
674 unsigned long long cpu_time, /* time spent on the cpu */ 670 unsigned long long run_delay; /* time spent waiting on a runqueue */
675 run_delay; /* time spent waiting on a runqueue */
676 671
677 /* timestamps */ 672 /* timestamps */
678 unsigned long long last_arrival,/* when we last ran on a cpu */ 673 unsigned long long last_arrival,/* when we last ran on a cpu */
@@ -941,38 +936,7 @@ partition_sched_domains(int ndoms_new, struct cpumask *doms_new,
941#endif /* !CONFIG_SMP */ 936#endif /* !CONFIG_SMP */
942 937
943struct io_context; /* See blkdev.h */ 938struct io_context; /* See blkdev.h */
944#define NGROUPS_SMALL 32
945#define NGROUPS_PER_BLOCK ((unsigned int)(PAGE_SIZE / sizeof(gid_t)))
946struct group_info {
947 int ngroups;
948 atomic_t usage;
949 gid_t small_block[NGROUPS_SMALL];
950 int nblocks;
951 gid_t *blocks[0];
952};
953 939
954/*
955 * get_group_info() must be called with the owning task locked (via task_lock())
956 * when task != current. The reason being that the vast majority of callers are
957 * looking at current->group_info, which can not be changed except by the
958 * current task. Changing current->group_info requires the task lock, too.
959 */
960#define get_group_info(group_info) do { \
961 atomic_inc(&(group_info)->usage); \
962} while (0)
963
964#define put_group_info(group_info) do { \
965 if (atomic_dec_and_test(&(group_info)->usage)) \
966 groups_free(group_info); \
967} while (0)
968
969extern struct group_info *groups_alloc(int gidsetsize);
970extern void groups_free(struct group_info *group_info);
971extern int set_current_groups(struct group_info *group_info);
972extern int groups_search(struct group_info *group_info, gid_t grp);
973/* access the groups "array" with this macro */
974#define GROUP_AT(gi, i) \
975 ((gi)->blocks[(i)/NGROUPS_PER_BLOCK][(i)%NGROUPS_PER_BLOCK])
976 940
977#ifdef ARCH_HAS_PREFETCH_SWITCH_STACK 941#ifdef ARCH_HAS_PREFETCH_SWITCH_STACK
978extern void prefetch_stack(struct task_struct *t); 942extern void prefetch_stack(struct task_struct *t);
@@ -1228,6 +1192,7 @@ struct task_struct {
1228 * The buffer to hold the BTS data. 1192 * The buffer to hold the BTS data.
1229 */ 1193 */
1230 void *bts_buffer; 1194 void *bts_buffer;
1195 size_t bts_size;
1231#endif /* CONFIG_X86_PTRACE_BTS */ 1196#endif /* CONFIG_X86_PTRACE_BTS */
1232 1197
1233 /* PID/PID hash table linkage. */ 1198 /* PID/PID hash table linkage. */
@@ -1251,17 +1216,12 @@ struct task_struct {
1251 struct list_head cpu_timers[3]; 1216 struct list_head cpu_timers[3];
1252 1217
1253/* process credentials */ 1218/* process credentials */
1254 uid_t uid,euid,suid,fsuid; 1219 const struct cred *real_cred; /* objective and real subjective task
1255 gid_t gid,egid,sgid,fsgid; 1220 * credentials (COW) */
1256 struct group_info *group_info; 1221 const struct cred *cred; /* effective (overridable) subjective task
1257 kernel_cap_t cap_effective, cap_inheritable, cap_permitted, cap_bset; 1222 * credentials (COW) */
1258 struct user_struct *user; 1223 struct mutex cred_exec_mutex; /* execve vs ptrace cred calculation mutex */
1259 unsigned securebits; 1224
1260#ifdef CONFIG_KEYS
1261 unsigned char jit_keyring; /* default keyring to attach requested keys to */
1262 struct key *request_key_auth; /* assumed request_key authority */
1263 struct key *thread_keyring; /* keyring private to this thread */
1264#endif
1265 char comm[TASK_COMM_LEN]; /* executable name excluding path 1225 char comm[TASK_COMM_LEN]; /* executable name excluding path
1266 - access with [gs]et_task_comm (which lock 1226 - access with [gs]et_task_comm (which lock
1267 it with task_lock()) 1227 it with task_lock())
@@ -1298,9 +1258,6 @@ struct task_struct {
1298 int (*notifier)(void *priv); 1258 int (*notifier)(void *priv);
1299 void *notifier_data; 1259 void *notifier_data;
1300 sigset_t *notifier_mask; 1260 sigset_t *notifier_mask;
1301#ifdef CONFIG_SECURITY
1302 void *security;
1303#endif
1304 struct audit_context *audit_context; 1261 struct audit_context *audit_context;
1305#ifdef CONFIG_AUDITSYSCALL 1262#ifdef CONFIG_AUDITSYSCALL
1306 uid_t loginuid; 1263 uid_t loginuid;
@@ -1857,7 +1814,6 @@ static inline struct user_struct *get_uid(struct user_struct *u)
1857 return u; 1814 return u;
1858} 1815}
1859extern void free_uid(struct user_struct *); 1816extern void free_uid(struct user_struct *);
1860extern void switch_uid(struct user_struct *);
1861extern void release_uids(struct user_namespace *ns); 1817extern void release_uids(struct user_namespace *ns);
1862 1818
1863#include <asm/current.h> 1819#include <asm/current.h>
@@ -1876,9 +1832,6 @@ extern void wake_up_new_task(struct task_struct *tsk,
1876extern void sched_fork(struct task_struct *p, int clone_flags); 1832extern void sched_fork(struct task_struct *p, int clone_flags);
1877extern void sched_dead(struct task_struct *p); 1833extern void sched_dead(struct task_struct *p);
1878 1834
1879extern int in_group_p(gid_t);
1880extern int in_egroup_p(gid_t);
1881
1882extern void proc_caches_init(void); 1835extern void proc_caches_init(void);
1883extern void flush_signals(struct task_struct *); 1836extern void flush_signals(struct task_struct *);
1884extern void ignore_signals(struct task_struct *); 1837extern void ignore_signals(struct task_struct *);
@@ -2010,6 +1963,8 @@ static inline unsigned long wait_task_inactive(struct task_struct *p,
2010#define for_each_process(p) \ 1963#define for_each_process(p) \
2011 for (p = &init_task ; (p = next_task(p)) != &init_task ; ) 1964 for (p = &init_task ; (p = next_task(p)) != &init_task ; )
2012 1965
1966extern bool is_single_threaded(struct task_struct *);
1967
2013/* 1968/*
2014 * Careful: do_each_thread/while_each_thread is a double loop so 1969 * Careful: do_each_thread/while_each_thread is a double loop so
2015 * 'break' will not work as expected - use goto instead. 1970 * 'break' will not work as expected - use goto instead.
diff --git a/include/linux/securebits.h b/include/linux/securebits.h
index 92f09bdf117..d2c5ed845bc 100644
--- a/include/linux/securebits.h
+++ b/include/linux/securebits.h
@@ -32,7 +32,7 @@
32 setting is locked or not. A setting which is locked cannot be 32 setting is locked or not. A setting which is locked cannot be
33 changed from user-level. */ 33 changed from user-level. */
34#define issecure_mask(X) (1 << (X)) 34#define issecure_mask(X) (1 << (X))
35#define issecure(X) (issecure_mask(X) & current->securebits) 35#define issecure(X) (issecure_mask(X) & current_cred_xxx(securebits))
36 36
37#define SECURE_ALL_BITS (issecure_mask(SECURE_NOROOT) | \ 37#define SECURE_ALL_BITS (issecure_mask(SECURE_NOROOT) | \
38 issecure_mask(SECURE_NO_SETUID_FIXUP) | \ 38 issecure_mask(SECURE_NO_SETUID_FIXUP) | \
diff --git a/include/linux/security.h b/include/linux/security.h
index e3d4ecda267..3416cb85e77 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -37,6 +37,10 @@
37/* Maximum number of letters for an LSM name string */ 37/* Maximum number of letters for an LSM name string */
38#define SECURITY_NAME_MAX 10 38#define SECURITY_NAME_MAX 10
39 39
40/* If capable should audit the security request */
41#define SECURITY_CAP_NOAUDIT 0
42#define SECURITY_CAP_AUDIT 1
43
40struct ctl_table; 44struct ctl_table;
41struct audit_krule; 45struct audit_krule;
42 46
@@ -44,25 +48,25 @@ struct audit_krule;
44 * These functions are in security/capability.c and are used 48 * These functions are in security/capability.c and are used
45 * as the default capabilities functions 49 * as the default capabilities functions
46 */ 50 */
47extern int cap_capable(struct task_struct *tsk, int cap); 51extern int cap_capable(struct task_struct *tsk, int cap, int audit);
48extern int cap_settime(struct timespec *ts, struct timezone *tz); 52extern int cap_settime(struct timespec *ts, struct timezone *tz);
49extern int cap_ptrace_may_access(struct task_struct *child, unsigned int mode); 53extern int cap_ptrace_may_access(struct task_struct *child, unsigned int mode);
50extern int cap_ptrace_traceme(struct task_struct *parent); 54extern int cap_ptrace_traceme(struct task_struct *parent);
51extern int cap_capget(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted); 55extern int cap_capget(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted);
52extern int cap_capset_check(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted); 56extern int cap_capset(struct cred *new, const struct cred *old,
53extern void cap_capset_set(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted); 57 const kernel_cap_t *effective,
54extern int cap_bprm_set_security(struct linux_binprm *bprm); 58 const kernel_cap_t *inheritable,
55extern void cap_bprm_apply_creds(struct linux_binprm *bprm, int unsafe); 59 const kernel_cap_t *permitted);
60extern int cap_bprm_set_creds(struct linux_binprm *bprm);
56extern int cap_bprm_secureexec(struct linux_binprm *bprm); 61extern int cap_bprm_secureexec(struct linux_binprm *bprm);
57extern int cap_inode_setxattr(struct dentry *dentry, const char *name, 62extern int cap_inode_setxattr(struct dentry *dentry, const char *name,
58 const void *value, size_t size, int flags); 63 const void *value, size_t size, int flags);
59extern int cap_inode_removexattr(struct dentry *dentry, const char *name); 64extern int cap_inode_removexattr(struct dentry *dentry, const char *name);
60extern int cap_inode_need_killpriv(struct dentry *dentry); 65extern int cap_inode_need_killpriv(struct dentry *dentry);
61extern int cap_inode_killpriv(struct dentry *dentry); 66extern int cap_inode_killpriv(struct dentry *dentry);
62extern int cap_task_post_setuid(uid_t old_ruid, uid_t old_euid, uid_t old_suid, int flags); 67extern int cap_task_fix_setuid(struct cred *new, const struct cred *old, int flags);
63extern void cap_task_reparent_to_init(struct task_struct *p);
64extern int cap_task_prctl(int option, unsigned long arg2, unsigned long arg3, 68extern int cap_task_prctl(int option, unsigned long arg2, unsigned long arg3,
65 unsigned long arg4, unsigned long arg5, long *rc_p); 69 unsigned long arg4, unsigned long arg5);
66extern int cap_task_setscheduler(struct task_struct *p, int policy, struct sched_param *lp); 70extern int cap_task_setscheduler(struct task_struct *p, int policy, struct sched_param *lp);
67extern int cap_task_setioprio(struct task_struct *p, int ioprio); 71extern int cap_task_setioprio(struct task_struct *p, int ioprio);
68extern int cap_task_setnice(struct task_struct *p, int nice); 72extern int cap_task_setnice(struct task_struct *p, int nice);
@@ -105,7 +109,7 @@ extern unsigned long mmap_min_addr;
105struct sched_param; 109struct sched_param;
106struct request_sock; 110struct request_sock;
107 111
108/* bprm_apply_creds unsafe reasons */ 112/* bprm->unsafe reasons */
109#define LSM_UNSAFE_SHARE 1 113#define LSM_UNSAFE_SHARE 1
110#define LSM_UNSAFE_PTRACE 2 114#define LSM_UNSAFE_PTRACE 2
111#define LSM_UNSAFE_PTRACE_CAP 4 115#define LSM_UNSAFE_PTRACE_CAP 4
@@ -149,36 +153,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
149 * 153 *
150 * Security hooks for program execution operations. 154 * Security hooks for program execution operations.
151 * 155 *
152 * @bprm_alloc_security: 156 * @bprm_set_creds:
153 * Allocate and attach a security structure to the @bprm->security field.
154 * The security field is initialized to NULL when the bprm structure is
155 * allocated.
156 * @bprm contains the linux_binprm structure to be modified.
157 * Return 0 if operation was successful.
158 * @bprm_free_security:
159 * @bprm contains the linux_binprm structure to be modified.
160 * Deallocate and clear the @bprm->security field.
161 * @bprm_apply_creds:
162 * Compute and set the security attributes of a process being transformed
163 * by an execve operation based on the old attributes (current->security)
164 * and the information saved in @bprm->security by the set_security hook.
165 * Since this hook function (and its caller) are void, this hook can not
166 * return an error. However, it can leave the security attributes of the
167 * process unchanged if an access failure occurs at this point.
168 * bprm_apply_creds is called under task_lock. @unsafe indicates various
169 * reasons why it may be unsafe to change security state.
170 * @bprm contains the linux_binprm structure.
171 * @bprm_post_apply_creds:
172 * Runs after bprm_apply_creds with the task_lock dropped, so that
173 * functions which cannot be called safely under the task_lock can
174 * be used. This hook is a good place to perform state changes on
175 * the process such as closing open file descriptors to which access
176 * is no longer granted if the attributes were changed.
177 * Note that a security module might need to save state between
178 * bprm_apply_creds and bprm_post_apply_creds to store the decision
179 * on whether the process may proceed.
180 * @bprm contains the linux_binprm structure.
181 * @bprm_set_security:
182 * Save security information in the bprm->security field, typically based 157 * Save security information in the bprm->security field, typically based
183 * on information about the bprm->file, for later use by the apply_creds 158 * on information about the bprm->file, for later use by the apply_creds
184 * hook. This hook may also optionally check permissions (e.g. for 159 * hook. This hook may also optionally check permissions (e.g. for
@@ -191,15 +166,30 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
191 * @bprm contains the linux_binprm structure. 166 * @bprm contains the linux_binprm structure.
192 * Return 0 if the hook is successful and permission is granted. 167 * Return 0 if the hook is successful and permission is granted.
193 * @bprm_check_security: 168 * @bprm_check_security:
194 * This hook mediates the point when a search for a binary handler will 169 * This hook mediates the point when a search for a binary handler will
195 * begin. It allows a check the @bprm->security value which is set in 170 * begin. It allows a check the @bprm->security value which is set in the
196 * the preceding set_security call. The primary difference from 171 * preceding set_creds call. The primary difference from set_creds is
197 * set_security is that the argv list and envp list are reliably 172 * that the argv list and envp list are reliably available in @bprm. This
198 * available in @bprm. This hook may be called multiple times 173 * hook may be called multiple times during a single execve; and in each
199 * during a single execve; and in each pass set_security is called 174 * pass set_creds is called first.
200 * first.
201 * @bprm contains the linux_binprm structure. 175 * @bprm contains the linux_binprm structure.
202 * Return 0 if the hook is successful and permission is granted. 176 * Return 0 if the hook is successful and permission is granted.
177 * @bprm_committing_creds:
178 * Prepare to install the new security attributes of a process being
179 * transformed by an execve operation, based on the old credentials
180 * pointed to by @current->cred and the information set in @bprm->cred by
181 * the bprm_set_creds hook. @bprm points to the linux_binprm structure.
182 * This hook is a good place to perform state changes on the process such
183 * as closing open file descriptors to which access will no longer be
184 * granted when the attributes are changed. This is called immediately
185 * before commit_creds().
186 * @bprm_committed_creds:
187 * Tidy up after the installation of the new security attributes of a
188 * process being transformed by an execve operation. The new credentials
189 * have, by this point, been set to @current->cred. @bprm points to the
190 * linux_binprm structure. This hook is a good place to perform state
191 * changes on the process such as clearing out non-inheritable signal
192 * state. This is called immediately after commit_creds().
203 * @bprm_secureexec: 193 * @bprm_secureexec:
204 * Return a boolean value (0 or 1) indicating whether a "secure exec" 194 * Return a boolean value (0 or 1) indicating whether a "secure exec"
205 * is required. The flag is passed in the auxiliary table 195 * is required. The flag is passed in the auxiliary table
@@ -585,15 +575,31 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
585 * manual page for definitions of the @clone_flags. 575 * manual page for definitions of the @clone_flags.
586 * @clone_flags contains the flags indicating what should be shared. 576 * @clone_flags contains the flags indicating what should be shared.
587 * Return 0 if permission is granted. 577 * Return 0 if permission is granted.
588 * @task_alloc_security: 578 * @cred_free:
589 * @p contains the task_struct for child process. 579 * @cred points to the credentials.
590 * Allocate and attach a security structure to the p->security field. The 580 * Deallocate and clear the cred->security field in a set of credentials.
591 * security field is initialized to NULL when the task structure is 581 * @cred_prepare:
592 * allocated. 582 * @new points to the new credentials.
593 * Return 0 if operation was successful. 583 * @old points to the original credentials.
594 * @task_free_security: 584 * @gfp indicates the atomicity of any memory allocations.
595 * @p contains the task_struct for process. 585 * Prepare a new set of credentials by copying the data from the old set.
596 * Deallocate and clear the p->security field. 586 * @cred_commit:
587 * @new points to the new credentials.
588 * @old points to the original credentials.
589 * Install a new set of credentials.
590 * @kernel_act_as:
591 * Set the credentials for a kernel service to act as (subjective context).
592 * @new points to the credentials to be modified.
593 * @secid specifies the security ID to be set
594 * The current task must be the one that nominated @secid.
595 * Return 0 if successful.
596 * @kernel_create_files_as:
597 * Set the file creation context in a set of credentials to be the same as
598 * the objective context of the specified inode.
599 * @new points to the credentials to be modified.
600 * @inode points to the inode to use as a reference.
601 * The current task must be the one that nominated @inode.
602 * Return 0 if successful.
597 * @task_setuid: 603 * @task_setuid:
598 * Check permission before setting one or more of the user identity 604 * Check permission before setting one or more of the user identity
599 * attributes of the current process. The @flags parameter indicates 605 * attributes of the current process. The @flags parameter indicates
@@ -606,15 +612,13 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
606 * @id2 contains a uid. 612 * @id2 contains a uid.
607 * @flags contains one of the LSM_SETID_* values. 613 * @flags contains one of the LSM_SETID_* values.
608 * Return 0 if permission is granted. 614 * Return 0 if permission is granted.
609 * @task_post_setuid: 615 * @task_fix_setuid:
610 * Update the module's state after setting one or more of the user 616 * Update the module's state after setting one or more of the user
611 * identity attributes of the current process. The @flags parameter 617 * identity attributes of the current process. The @flags parameter
612 * indicates which of the set*uid system calls invoked this hook. If 618 * indicates which of the set*uid system calls invoked this hook. If
613 * @flags is LSM_SETID_FS, then @old_ruid is the old fs uid and the other 619 * @new is the set of credentials that will be installed. Modifications
614 * parameters are not used. 620 * should be made to this rather than to @current->cred.
615 * @old_ruid contains the old real uid (or fs uid if LSM_SETID_FS). 621 * @old is the set of credentials that are being replaces
616 * @old_euid contains the old effective uid (or -1 if LSM_SETID_FS).
617 * @old_suid contains the old saved uid (or -1 if LSM_SETID_FS).
618 * @flags contains one of the LSM_SETID_* values. 622 * @flags contains one of the LSM_SETID_* values.
619 * Return 0 on success. 623 * Return 0 on success.
620 * @task_setgid: 624 * @task_setgid:
@@ -717,13 +721,8 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
717 * @arg3 contains a argument. 721 * @arg3 contains a argument.
718 * @arg4 contains a argument. 722 * @arg4 contains a argument.
719 * @arg5 contains a argument. 723 * @arg5 contains a argument.
720 * @rc_p contains a pointer to communicate back the forced return code 724 * Return -ENOSYS if no-one wanted to handle this op, any other value to
721 * Return 0 if permission is granted, and non-zero if the security module 725 * cause prctl() to return immediately with that value.
722 * has taken responsibility (setting *rc_p) for the prctl call.
723 * @task_reparent_to_init:
724 * Set the security attributes in @p->security for a kernel thread that
725 * is being reparented to the init task.
726 * @p contains the task_struct for the kernel thread.
727 * @task_to_inode: 726 * @task_to_inode:
728 * Set the security attributes for an inode based on an associated task's 727 * Set the security attributes for an inode based on an associated task's
729 * security attributes, e.g. for /proc/pid inodes. 728 * security attributes, e.g. for /proc/pid inodes.
@@ -1000,7 +999,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1000 * See whether a specific operational right is granted to a process on a 999 * See whether a specific operational right is granted to a process on a
1001 * key. 1000 * key.
1002 * @key_ref refers to the key (key pointer + possession attribute bit). 1001 * @key_ref refers to the key (key pointer + possession attribute bit).
1003 * @context points to the process to provide the context against which to 1002 * @cred points to the credentials to provide the context against which to
1004 * evaluate the security data on the key. 1003 * evaluate the security data on the key.
1005 * @perm describes the combination of permissions required of this key. 1004 * @perm describes the combination of permissions required of this key.
1006 * Return 1 if permission granted, 0 if permission denied and -ve it the 1005 * Return 1 if permission granted, 0 if permission denied and -ve it the
@@ -1162,6 +1161,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1162 * @child process. 1161 * @child process.
1163 * Security modules may also want to perform a process tracing check 1162 * Security modules may also want to perform a process tracing check
1164 * during an execve in the set_security or apply_creds hooks of 1163 * during an execve in the set_security or apply_creds hooks of
1164 * tracing check during an execve in the bprm_set_creds hook of
1165 * binprm_security_ops if the process is being traced and its security 1165 * binprm_security_ops if the process is being traced and its security
1166 * attributes would be changed by the execve. 1166 * attributes would be changed by the execve.
1167 * @child contains the task_struct structure for the target process. 1167 * @child contains the task_struct structure for the target process.
@@ -1185,29 +1185,15 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1185 * @inheritable contains the inheritable capability set. 1185 * @inheritable contains the inheritable capability set.
1186 * @permitted contains the permitted capability set. 1186 * @permitted contains the permitted capability set.
1187 * Return 0 if the capability sets were successfully obtained. 1187 * Return 0 if the capability sets were successfully obtained.
1188 * @capset_check: 1188 * @capset:
1189 * Check permission before setting the @effective, @inheritable, and
1190 * @permitted capability sets for the @target process.
1191 * Caveat: @target is also set to current if a set of processes is
1192 * specified (i.e. all processes other than current and init or a
1193 * particular process group). Hence, the capset_set hook may need to
1194 * revalidate permission to the actual target process.
1195 * @target contains the task_struct structure for target process.
1196 * @effective contains the effective capability set.
1197 * @inheritable contains the inheritable capability set.
1198 * @permitted contains the permitted capability set.
1199 * Return 0 if permission is granted.
1200 * @capset_set:
1201 * Set the @effective, @inheritable, and @permitted capability sets for 1189 * Set the @effective, @inheritable, and @permitted capability sets for
1202 * the @target process. Since capset_check cannot always check permission 1190 * the current process.
1203 * to the real @target process, this hook may also perform permission 1191 * @new contains the new credentials structure for target process.
1204 * checking to determine if the current process is allowed to set the 1192 * @old contains the current credentials structure for target process.
1205 * capability sets of the @target process. However, this hook has no way
1206 * of returning an error due to the structure of the sys_capset code.
1207 * @target contains the task_struct structure for target process.
1208 * @effective contains the effective capability set. 1193 * @effective contains the effective capability set.
1209 * @inheritable contains the inheritable capability set. 1194 * @inheritable contains the inheritable capability set.
1210 * @permitted contains the permitted capability set. 1195 * @permitted contains the permitted capability set.
1196 * Return 0 and update @new if permission is granted.
1211 * @capable: 1197 * @capable:
1212 * Check whether the @tsk process has the @cap capability. 1198 * Check whether the @tsk process has the @cap capability.
1213 * @tsk contains the task_struct for the process. 1199 * @tsk contains the task_struct for the process.
@@ -1299,15 +1285,12 @@ struct security_operations {
1299 int (*capget) (struct task_struct *target, 1285 int (*capget) (struct task_struct *target,
1300 kernel_cap_t *effective, 1286 kernel_cap_t *effective,
1301 kernel_cap_t *inheritable, kernel_cap_t *permitted); 1287 kernel_cap_t *inheritable, kernel_cap_t *permitted);
1302 int (*capset_check) (struct task_struct *target, 1288 int (*capset) (struct cred *new,
1303 kernel_cap_t *effective, 1289 const struct cred *old,
1304 kernel_cap_t *inheritable, 1290 const kernel_cap_t *effective,
1305 kernel_cap_t *permitted); 1291 const kernel_cap_t *inheritable,
1306 void (*capset_set) (struct task_struct *target, 1292 const kernel_cap_t *permitted);
1307 kernel_cap_t *effective, 1293 int (*capable) (struct task_struct *tsk, int cap, int audit);
1308 kernel_cap_t *inheritable,
1309 kernel_cap_t *permitted);
1310 int (*capable) (struct task_struct *tsk, int cap);
1311 int (*acct) (struct file *file); 1294 int (*acct) (struct file *file);
1312 int (*sysctl) (struct ctl_table *table, int op); 1295 int (*sysctl) (struct ctl_table *table, int op);
1313 int (*quotactl) (int cmds, int type, int id, struct super_block *sb); 1296 int (*quotactl) (int cmds, int type, int id, struct super_block *sb);
@@ -1316,18 +1299,16 @@ struct security_operations {
1316 int (*settime) (struct timespec *ts, struct timezone *tz); 1299 int (*settime) (struct timespec *ts, struct timezone *tz);
1317 int (*vm_enough_memory) (struct mm_struct *mm, long pages); 1300 int (*vm_enough_memory) (struct mm_struct *mm, long pages);
1318 1301
1319 int (*bprm_alloc_security) (struct linux_binprm *bprm); 1302 int (*bprm_set_creds) (struct linux_binprm *bprm);
1320 void (*bprm_free_security) (struct linux_binprm *bprm);
1321 void (*bprm_apply_creds) (struct linux_binprm *bprm, int unsafe);
1322 void (*bprm_post_apply_creds) (struct linux_binprm *bprm);
1323 int (*bprm_set_security) (struct linux_binprm *bprm);
1324 int (*bprm_check_security) (struct linux_binprm *bprm); 1303 int (*bprm_check_security) (struct linux_binprm *bprm);
1325 int (*bprm_secureexec) (struct linux_binprm *bprm); 1304 int (*bprm_secureexec) (struct linux_binprm *bprm);
1305 void (*bprm_committing_creds) (struct linux_binprm *bprm);
1306 void (*bprm_committed_creds) (struct linux_binprm *bprm);
1326 1307
1327 int (*sb_alloc_security) (struct super_block *sb); 1308 int (*sb_alloc_security) (struct super_block *sb);
1328 void (*sb_free_security) (struct super_block *sb); 1309 void (*sb_free_security) (struct super_block *sb);
1329 int (*sb_copy_data) (char *orig, char *copy); 1310 int (*sb_copy_data) (char *orig, char *copy);
1330 int (*sb_kern_mount) (struct super_block *sb, void *data); 1311 int (*sb_kern_mount) (struct super_block *sb, int flags, void *data);
1331 int (*sb_show_options) (struct seq_file *m, struct super_block *sb); 1312 int (*sb_show_options) (struct seq_file *m, struct super_block *sb);
1332 int (*sb_statfs) (struct dentry *dentry); 1313 int (*sb_statfs) (struct dentry *dentry);
1333 int (*sb_mount) (char *dev_name, struct path *path, 1314 int (*sb_mount) (char *dev_name, struct path *path,
@@ -1406,14 +1387,18 @@ struct security_operations {
1406 int (*file_send_sigiotask) (struct task_struct *tsk, 1387 int (*file_send_sigiotask) (struct task_struct *tsk,
1407 struct fown_struct *fown, int sig); 1388 struct fown_struct *fown, int sig);
1408 int (*file_receive) (struct file *file); 1389 int (*file_receive) (struct file *file);
1409 int (*dentry_open) (struct file *file); 1390 int (*dentry_open) (struct file *file, const struct cred *cred);
1410 1391
1411 int (*task_create) (unsigned long clone_flags); 1392 int (*task_create) (unsigned long clone_flags);
1412 int (*task_alloc_security) (struct task_struct *p); 1393 void (*cred_free) (struct cred *cred);
1413 void (*task_free_security) (struct task_struct *p); 1394 int (*cred_prepare)(struct cred *new, const struct cred *old,
1395 gfp_t gfp);
1396 void (*cred_commit)(struct cred *new, const struct cred *old);
1397 int (*kernel_act_as)(struct cred *new, u32 secid);
1398 int (*kernel_create_files_as)(struct cred *new, struct inode *inode);
1414 int (*task_setuid) (uid_t id0, uid_t id1, uid_t id2, int flags); 1399 int (*task_setuid) (uid_t id0, uid_t id1, uid_t id2, int flags);
1415 int (*task_post_setuid) (uid_t old_ruid /* or fsuid */ , 1400 int (*task_fix_setuid) (struct cred *new, const struct cred *old,
1416 uid_t old_euid, uid_t old_suid, int flags); 1401 int flags);
1417 int (*task_setgid) (gid_t id0, gid_t id1, gid_t id2, int flags); 1402 int (*task_setgid) (gid_t id0, gid_t id1, gid_t id2, int flags);
1418 int (*task_setpgid) (struct task_struct *p, pid_t pgid); 1403 int (*task_setpgid) (struct task_struct *p, pid_t pgid);
1419 int (*task_getpgid) (struct task_struct *p); 1404 int (*task_getpgid) (struct task_struct *p);
@@ -1433,8 +1418,7 @@ struct security_operations {
1433 int (*task_wait) (struct task_struct *p); 1418 int (*task_wait) (struct task_struct *p);
1434 int (*task_prctl) (int option, unsigned long arg2, 1419 int (*task_prctl) (int option, unsigned long arg2,
1435 unsigned long arg3, unsigned long arg4, 1420 unsigned long arg3, unsigned long arg4,
1436 unsigned long arg5, long *rc_p); 1421 unsigned long arg5);
1437 void (*task_reparent_to_init) (struct task_struct *p);
1438 void (*task_to_inode) (struct task_struct *p, struct inode *inode); 1422 void (*task_to_inode) (struct task_struct *p, struct inode *inode);
1439 1423
1440 int (*ipc_permission) (struct kern_ipc_perm *ipcp, short flag); 1424 int (*ipc_permission) (struct kern_ipc_perm *ipcp, short flag);
@@ -1539,10 +1523,10 @@ struct security_operations {
1539 1523
1540 /* key management security hooks */ 1524 /* key management security hooks */
1541#ifdef CONFIG_KEYS 1525#ifdef CONFIG_KEYS
1542 int (*key_alloc) (struct key *key, struct task_struct *tsk, unsigned long flags); 1526 int (*key_alloc) (struct key *key, const struct cred *cred, unsigned long flags);
1543 void (*key_free) (struct key *key); 1527 void (*key_free) (struct key *key);
1544 int (*key_permission) (key_ref_t key_ref, 1528 int (*key_permission) (key_ref_t key_ref,
1545 struct task_struct *context, 1529 const struct cred *cred,
1546 key_perm_t perm); 1530 key_perm_t perm);
1547 int (*key_getsecurity)(struct key *key, char **_buffer); 1531 int (*key_getsecurity)(struct key *key, char **_buffer);
1548#endif /* CONFIG_KEYS */ 1532#endif /* CONFIG_KEYS */
@@ -1568,15 +1552,12 @@ int security_capget(struct task_struct *target,
1568 kernel_cap_t *effective, 1552 kernel_cap_t *effective,
1569 kernel_cap_t *inheritable, 1553 kernel_cap_t *inheritable,
1570 kernel_cap_t *permitted); 1554 kernel_cap_t *permitted);
1571int security_capset_check(struct task_struct *target, 1555int security_capset(struct cred *new, const struct cred *old,
1572 kernel_cap_t *effective, 1556 const kernel_cap_t *effective,
1573 kernel_cap_t *inheritable, 1557 const kernel_cap_t *inheritable,
1574 kernel_cap_t *permitted); 1558 const kernel_cap_t *permitted);
1575void security_capset_set(struct task_struct *target,
1576 kernel_cap_t *effective,
1577 kernel_cap_t *inheritable,
1578 kernel_cap_t *permitted);
1579int security_capable(struct task_struct *tsk, int cap); 1559int security_capable(struct task_struct *tsk, int cap);
1560int security_capable_noaudit(struct task_struct *tsk, int cap);
1580int security_acct(struct file *file); 1561int security_acct(struct file *file);
1581int security_sysctl(struct ctl_table *table, int op); 1562int security_sysctl(struct ctl_table *table, int op);
1582int security_quotactl(int cmds, int type, int id, struct super_block *sb); 1563int security_quotactl(int cmds, int type, int id, struct super_block *sb);
@@ -1586,17 +1567,15 @@ int security_settime(struct timespec *ts, struct timezone *tz);
1586int security_vm_enough_memory(long pages); 1567int security_vm_enough_memory(long pages);
1587int security_vm_enough_memory_mm(struct mm_struct *mm, long pages); 1568int security_vm_enough_memory_mm(struct mm_struct *mm, long pages);
1588int security_vm_enough_memory_kern(long pages); 1569int security_vm_enough_memory_kern(long pages);
1589int security_bprm_alloc(struct linux_binprm *bprm); 1570int security_bprm_set_creds(struct linux_binprm *bprm);
1590void security_bprm_free(struct linux_binprm *bprm);
1591void security_bprm_apply_creds(struct linux_binprm *bprm, int unsafe);
1592void security_bprm_post_apply_creds(struct linux_binprm *bprm);
1593int security_bprm_set(struct linux_binprm *bprm);
1594int security_bprm_check(struct linux_binprm *bprm); 1571int security_bprm_check(struct linux_binprm *bprm);
1572void security_bprm_committing_creds(struct linux_binprm *bprm);
1573void security_bprm_committed_creds(struct linux_binprm *bprm);
1595int security_bprm_secureexec(struct linux_binprm *bprm); 1574int security_bprm_secureexec(struct linux_binprm *bprm);
1596int security_sb_alloc(struct super_block *sb); 1575int security_sb_alloc(struct super_block *sb);
1597void security_sb_free(struct super_block *sb); 1576void security_sb_free(struct super_block *sb);
1598int security_sb_copy_data(char *orig, char *copy); 1577int security_sb_copy_data(char *orig, char *copy);
1599int security_sb_kern_mount(struct super_block *sb, void *data); 1578int security_sb_kern_mount(struct super_block *sb, int flags, void *data);
1600int security_sb_show_options(struct seq_file *m, struct super_block *sb); 1579int security_sb_show_options(struct seq_file *m, struct super_block *sb);
1601int security_sb_statfs(struct dentry *dentry); 1580int security_sb_statfs(struct dentry *dentry);
1602int security_sb_mount(char *dev_name, struct path *path, 1581int security_sb_mount(char *dev_name, struct path *path,
@@ -1663,13 +1642,16 @@ int security_file_set_fowner(struct file *file);
1663int security_file_send_sigiotask(struct task_struct *tsk, 1642int security_file_send_sigiotask(struct task_struct *tsk,
1664 struct fown_struct *fown, int sig); 1643 struct fown_struct *fown, int sig);
1665int security_file_receive(struct file *file); 1644int security_file_receive(struct file *file);
1666int security_dentry_open(struct file *file); 1645int security_dentry_open(struct file *file, const struct cred *cred);
1667int security_task_create(unsigned long clone_flags); 1646int security_task_create(unsigned long clone_flags);
1668int security_task_alloc(struct task_struct *p); 1647void security_cred_free(struct cred *cred);
1669void security_task_free(struct task_struct *p); 1648int security_prepare_creds(struct cred *new, const struct cred *old, gfp_t gfp);
1649void security_commit_creds(struct cred *new, const struct cred *old);
1650int security_kernel_act_as(struct cred *new, u32 secid);
1651int security_kernel_create_files_as(struct cred *new, struct inode *inode);
1670int security_task_setuid(uid_t id0, uid_t id1, uid_t id2, int flags); 1652int security_task_setuid(uid_t id0, uid_t id1, uid_t id2, int flags);
1671int security_task_post_setuid(uid_t old_ruid, uid_t old_euid, 1653int security_task_fix_setuid(struct cred *new, const struct cred *old,
1672 uid_t old_suid, int flags); 1654 int flags);
1673int security_task_setgid(gid_t id0, gid_t id1, gid_t id2, int flags); 1655int security_task_setgid(gid_t id0, gid_t id1, gid_t id2, int flags);
1674int security_task_setpgid(struct task_struct *p, pid_t pgid); 1656int security_task_setpgid(struct task_struct *p, pid_t pgid);
1675int security_task_getpgid(struct task_struct *p); 1657int security_task_getpgid(struct task_struct *p);
@@ -1688,8 +1670,7 @@ int security_task_kill(struct task_struct *p, struct siginfo *info,
1688 int sig, u32 secid); 1670 int sig, u32 secid);
1689int security_task_wait(struct task_struct *p); 1671int security_task_wait(struct task_struct *p);
1690int security_task_prctl(int option, unsigned long arg2, unsigned long arg3, 1672int security_task_prctl(int option, unsigned long arg2, unsigned long arg3,
1691 unsigned long arg4, unsigned long arg5, long *rc_p); 1673 unsigned long arg4, unsigned long arg5);
1692void security_task_reparent_to_init(struct task_struct *p);
1693void security_task_to_inode(struct task_struct *p, struct inode *inode); 1674void security_task_to_inode(struct task_struct *p, struct inode *inode);
1694int security_ipc_permission(struct kern_ipc_perm *ipcp, short flag); 1675int security_ipc_permission(struct kern_ipc_perm *ipcp, short flag);
1695void security_ipc_getsecid(struct kern_ipc_perm *ipcp, u32 *secid); 1676void security_ipc_getsecid(struct kern_ipc_perm *ipcp, u32 *secid);
@@ -1764,25 +1745,23 @@ static inline int security_capget(struct task_struct *target,
1764 return cap_capget(target, effective, inheritable, permitted); 1745 return cap_capget(target, effective, inheritable, permitted);
1765} 1746}
1766 1747
1767static inline int security_capset_check(struct task_struct *target, 1748static inline int security_capset(struct cred *new,
1768 kernel_cap_t *effective, 1749 const struct cred *old,
1769 kernel_cap_t *inheritable, 1750 const kernel_cap_t *effective,
1770 kernel_cap_t *permitted) 1751 const kernel_cap_t *inheritable,
1752 const kernel_cap_t *permitted)
1771{ 1753{
1772 return cap_capset_check(target, effective, inheritable, permitted); 1754 return cap_capset(new, old, effective, inheritable, permitted);
1773} 1755}
1774 1756
1775static inline void security_capset_set(struct task_struct *target, 1757static inline int security_capable(struct task_struct *tsk, int cap)
1776 kernel_cap_t *effective,
1777 kernel_cap_t *inheritable,
1778 kernel_cap_t *permitted)
1779{ 1758{
1780 cap_capset_set(target, effective, inheritable, permitted); 1759 return cap_capable(tsk, cap, SECURITY_CAP_AUDIT);
1781} 1760}
1782 1761
1783static inline int security_capable(struct task_struct *tsk, int cap) 1762static inline int security_capable_noaudit(struct task_struct *tsk, int cap)
1784{ 1763{
1785 return cap_capable(tsk, cap); 1764 return cap_capable(tsk, cap, SECURITY_CAP_NOAUDIT);
1786} 1765}
1787 1766
1788static inline int security_acct(struct file *file) 1767static inline int security_acct(struct file *file)
@@ -1835,32 +1814,22 @@ static inline int security_vm_enough_memory_kern(long pages)
1835 return cap_vm_enough_memory(current->mm, pages); 1814 return cap_vm_enough_memory(current->mm, pages);
1836} 1815}
1837 1816
1838static inline int security_bprm_alloc(struct linux_binprm *bprm) 1817static inline int security_bprm_set_creds(struct linux_binprm *bprm)
1839{
1840 return 0;
1841}
1842
1843static inline void security_bprm_free(struct linux_binprm *bprm)
1844{ }
1845
1846static inline void security_bprm_apply_creds(struct linux_binprm *bprm, int unsafe)
1847{ 1818{
1848 cap_bprm_apply_creds(bprm, unsafe); 1819 return cap_bprm_set_creds(bprm);
1849} 1820}
1850 1821
1851static inline void security_bprm_post_apply_creds(struct linux_binprm *bprm) 1822static inline int security_bprm_check(struct linux_binprm *bprm)
1852{ 1823{
1853 return; 1824 return 0;
1854} 1825}
1855 1826
1856static inline int security_bprm_set(struct linux_binprm *bprm) 1827static inline void security_bprm_committing_creds(struct linux_binprm *bprm)
1857{ 1828{
1858 return cap_bprm_set_security(bprm);
1859} 1829}
1860 1830
1861static inline int security_bprm_check(struct linux_binprm *bprm) 1831static inline void security_bprm_committed_creds(struct linux_binprm *bprm)
1862{ 1832{
1863 return 0;
1864} 1833}
1865 1834
1866static inline int security_bprm_secureexec(struct linux_binprm *bprm) 1835static inline int security_bprm_secureexec(struct linux_binprm *bprm)
@@ -1881,7 +1850,7 @@ static inline int security_sb_copy_data(char *orig, char *copy)
1881 return 0; 1850 return 0;
1882} 1851}
1883 1852
1884static inline int security_sb_kern_mount(struct super_block *sb, void *data) 1853static inline int security_sb_kern_mount(struct super_block *sb, int flags, void *data)
1885{ 1854{
1886 return 0; 1855 return 0;
1887} 1856}
@@ -2177,7 +2146,8 @@ static inline int security_file_receive(struct file *file)
2177 return 0; 2146 return 0;
2178} 2147}
2179 2148
2180static inline int security_dentry_open(struct file *file) 2149static inline int security_dentry_open(struct file *file,
2150 const struct cred *cred)
2181{ 2151{
2182 return 0; 2152 return 0;
2183} 2153}
@@ -2187,13 +2157,31 @@ static inline int security_task_create(unsigned long clone_flags)
2187 return 0; 2157 return 0;
2188} 2158}
2189 2159
2190static inline int security_task_alloc(struct task_struct *p) 2160static inline void security_cred_free(struct cred *cred)
2161{ }
2162
2163static inline int security_prepare_creds(struct cred *new,
2164 const struct cred *old,
2165 gfp_t gfp)
2191{ 2166{
2192 return 0; 2167 return 0;
2193} 2168}
2194 2169
2195static inline void security_task_free(struct task_struct *p) 2170static inline void security_commit_creds(struct cred *new,
2196{ } 2171 const struct cred *old)
2172{
2173}
2174
2175static inline int security_kernel_act_as(struct cred *cred, u32 secid)
2176{
2177 return 0;
2178}
2179
2180static inline int security_kernel_create_files_as(struct cred *cred,
2181 struct inode *inode)
2182{
2183 return 0;
2184}
2197 2185
2198static inline int security_task_setuid(uid_t id0, uid_t id1, uid_t id2, 2186static inline int security_task_setuid(uid_t id0, uid_t id1, uid_t id2,
2199 int flags) 2187 int flags)
@@ -2201,10 +2189,11 @@ static inline int security_task_setuid(uid_t id0, uid_t id1, uid_t id2,
2201 return 0; 2189 return 0;
2202} 2190}
2203 2191
2204static inline int security_task_post_setuid(uid_t old_ruid, uid_t old_euid, 2192static inline int security_task_fix_setuid(struct cred *new,
2205 uid_t old_suid, int flags) 2193 const struct cred *old,
2194 int flags)
2206{ 2195{
2207 return cap_task_post_setuid(old_ruid, old_euid, old_suid, flags); 2196 return cap_task_fix_setuid(new, old, flags);
2208} 2197}
2209 2198
2210static inline int security_task_setgid(gid_t id0, gid_t id1, gid_t id2, 2199static inline int security_task_setgid(gid_t id0, gid_t id1, gid_t id2,
@@ -2291,14 +2280,9 @@ static inline int security_task_wait(struct task_struct *p)
2291static inline int security_task_prctl(int option, unsigned long arg2, 2280static inline int security_task_prctl(int option, unsigned long arg2,
2292 unsigned long arg3, 2281 unsigned long arg3,
2293 unsigned long arg4, 2282 unsigned long arg4,
2294 unsigned long arg5, long *rc_p) 2283 unsigned long arg5)
2295{
2296 return cap_task_prctl(option, arg2, arg3, arg3, arg5, rc_p);
2297}
2298
2299static inline void security_task_reparent_to_init(struct task_struct *p)
2300{ 2284{
2301 cap_task_reparent_to_init(p); 2285 return cap_task_prctl(option, arg2, arg3, arg3, arg5);
2302} 2286}
2303 2287
2304static inline void security_task_to_inode(struct task_struct *p, struct inode *inode) 2288static inline void security_task_to_inode(struct task_struct *p, struct inode *inode)
@@ -2724,16 +2708,16 @@ static inline void security_skb_classify_flow(struct sk_buff *skb, struct flowi
2724#ifdef CONFIG_KEYS 2708#ifdef CONFIG_KEYS
2725#ifdef CONFIG_SECURITY 2709#ifdef CONFIG_SECURITY
2726 2710
2727int security_key_alloc(struct key *key, struct task_struct *tsk, unsigned long flags); 2711int security_key_alloc(struct key *key, const struct cred *cred, unsigned long flags);
2728void security_key_free(struct key *key); 2712void security_key_free(struct key *key);
2729int security_key_permission(key_ref_t key_ref, 2713int security_key_permission(key_ref_t key_ref,
2730 struct task_struct *context, key_perm_t perm); 2714 const struct cred *cred, key_perm_t perm);
2731int security_key_getsecurity(struct key *key, char **_buffer); 2715int security_key_getsecurity(struct key *key, char **_buffer);
2732 2716
2733#else 2717#else
2734 2718
2735static inline int security_key_alloc(struct key *key, 2719static inline int security_key_alloc(struct key *key,
2736 struct task_struct *tsk, 2720 const struct cred *cred,
2737 unsigned long flags) 2721 unsigned long flags)
2738{ 2722{
2739 return 0; 2723 return 0;
@@ -2744,7 +2728,7 @@ static inline void security_key_free(struct key *key)
2744} 2728}
2745 2729
2746static inline int security_key_permission(key_ref_t key_ref, 2730static inline int security_key_permission(key_ref_t key_ref,
2747 struct task_struct *context, 2731 const struct cred *cred,
2748 key_perm_t perm) 2732 key_perm_t perm)
2749{ 2733{
2750 return 0; 2734 return 0;
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h
index b3dfa72f13b..40ea5058c2e 100644
--- a/include/linux/seq_file.h
+++ b/include/linux/seq_file.h
@@ -50,10 +50,11 @@ int seq_path(struct seq_file *, struct path *, char *);
50int seq_dentry(struct seq_file *, struct dentry *, char *); 50int seq_dentry(struct seq_file *, struct dentry *, char *);
51int seq_path_root(struct seq_file *m, struct path *path, struct path *root, 51int seq_path_root(struct seq_file *m, struct path *path, struct path *root,
52 char *esc); 52 char *esc);
53int seq_bitmap(struct seq_file *m, unsigned long *bits, unsigned int nr_bits); 53int seq_bitmap(struct seq_file *m, const unsigned long *bits,
54static inline int seq_cpumask(struct seq_file *m, cpumask_t *mask) 54 unsigned int nr_bits);
55static inline int seq_cpumask(struct seq_file *m, const struct cpumask *mask)
55{ 56{
56 return seq_bitmap(m, mask->bits, NR_CPUS); 57 return seq_bitmap(m, mask->bits, nr_cpu_ids);
57} 58}
58 59
59static inline int seq_nodemask(struct seq_file *m, nodemask_t *mask) 60static inline int seq_nodemask(struct seq_file *m, nodemask_t *mask)
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 4e4f1277f3b..feb3b939ec4 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -158,6 +158,8 @@
158/* SH-SCI */ 158/* SH-SCI */
159#define PORT_SCIFA 83 159#define PORT_SCIFA 83
160 160
161#define PORT_S3C6400 84
162
161#ifdef __KERNEL__ 163#ifdef __KERNEL__
162 164
163#include <linux/compiler.h> 165#include <linux/compiler.h>
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 2725f4e5a9b..cf2cb50f77d 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -250,6 +250,9 @@ typedef unsigned char *sk_buff_data_t;
250 * @tc_verd: traffic control verdict 250 * @tc_verd: traffic control verdict
251 * @ndisc_nodetype: router type (from link layer) 251 * @ndisc_nodetype: router type (from link layer)
252 * @do_not_encrypt: set to prevent encryption of this frame 252 * @do_not_encrypt: set to prevent encryption of this frame
253 * @requeue: set to indicate that the wireless core should attempt
254 * a software retry on this frame if we failed to
255 * receive an ACK for it
253 * @dma_cookie: a cookie to one of several possible DMA operations 256 * @dma_cookie: a cookie to one of several possible DMA operations
254 * done by skb DMA functions 257 * done by skb DMA functions
255 * @secmark: security marking 258 * @secmark: security marking
@@ -269,8 +272,9 @@ struct sk_buff {
269 struct dst_entry *dst; 272 struct dst_entry *dst;
270 struct rtable *rtable; 273 struct rtable *rtable;
271 }; 274 };
275#ifdef CONFIG_XFRM
272 struct sec_path *sp; 276 struct sec_path *sp;
273 277#endif
274 /* 278 /*
275 * This is the control buffer. It is free to use for every 279 * This is the control buffer. It is free to use for every
276 * layer. Please put your private variables there. If you 280 * layer. Please put your private variables there. If you
@@ -325,6 +329,7 @@ struct sk_buff {
325#endif 329#endif
326#if defined(CONFIG_MAC80211) || defined(CONFIG_MAC80211_MODULE) 330#if defined(CONFIG_MAC80211) || defined(CONFIG_MAC80211_MODULE)
327 __u8 do_not_encrypt:1; 331 __u8 do_not_encrypt:1;
332 __u8 requeue:1;
328#endif 333#endif
329 /* 0/13/14 bit hole */ 334 /* 0/13/14 bit hole */
330 335
@@ -488,6 +493,19 @@ static inline bool skb_queue_is_last(const struct sk_buff_head *list,
488} 493}
489 494
490/** 495/**
496 * skb_queue_is_first - check if skb is the first entry in the queue
497 * @list: queue head
498 * @skb: buffer
499 *
500 * Returns true if @skb is the first buffer on the list.
501 */
502static inline bool skb_queue_is_first(const struct sk_buff_head *list,
503 const struct sk_buff *skb)
504{
505 return (skb->prev == (struct sk_buff *) list);
506}
507
508/**
491 * skb_queue_next - return the next packet in the queue 509 * skb_queue_next - return the next packet in the queue
492 * @list: queue head 510 * @list: queue head
493 * @skb: current buffer 511 * @skb: current buffer
@@ -506,6 +524,24 @@ static inline struct sk_buff *skb_queue_next(const struct sk_buff_head *list,
506} 524}
507 525
508/** 526/**
527 * skb_queue_prev - return the prev packet in the queue
528 * @list: queue head
529 * @skb: current buffer
530 *
531 * Return the prev packet in @list before @skb. It is only valid to
532 * call this if skb_queue_is_first() evaluates to false.
533 */
534static inline struct sk_buff *skb_queue_prev(const struct sk_buff_head *list,
535 const struct sk_buff *skb)
536{
537 /* This BUG_ON may seem severe, but if we just return then we
538 * are going to dereference garbage.
539 */
540 BUG_ON(skb_queue_is_first(list, skb));
541 return skb->prev;
542}
543
544/**
509 * skb_get - reference buffer 545 * skb_get - reference buffer
510 * @skb: buffer to reference 546 * @skb: buffer to reference
511 * 547 *
@@ -1647,8 +1683,12 @@ extern int skb_splice_bits(struct sk_buff *skb,
1647extern void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to); 1683extern void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to);
1648extern void skb_split(struct sk_buff *skb, 1684extern void skb_split(struct sk_buff *skb,
1649 struct sk_buff *skb1, const u32 len); 1685 struct sk_buff *skb1, const u32 len);
1686extern int skb_shift(struct sk_buff *tgt, struct sk_buff *skb,
1687 int shiftlen);
1650 1688
1651extern struct sk_buff *skb_segment(struct sk_buff *skb, int features); 1689extern struct sk_buff *skb_segment(struct sk_buff *skb, int features);
1690extern int skb_gro_receive(struct sk_buff **head,
1691 struct sk_buff *skb);
1652 1692
1653static inline void *skb_header_pointer(const struct sk_buff *skb, int offset, 1693static inline void *skb_header_pointer(const struct sk_buff *skb, int offset,
1654 int len, void *buffer) 1694 int len, void *buffer)
@@ -1864,6 +1904,18 @@ static inline void skb_copy_queue_mapping(struct sk_buff *to, const struct sk_bu
1864 to->queue_mapping = from->queue_mapping; 1904 to->queue_mapping = from->queue_mapping;
1865} 1905}
1866 1906
1907#ifdef CONFIG_XFRM
1908static inline struct sec_path *skb_sec_path(struct sk_buff *skb)
1909{
1910 return skb->sp;
1911}
1912#else
1913static inline struct sec_path *skb_sec_path(struct sk_buff *skb)
1914{
1915 return NULL;
1916}
1917#endif
1918
1867static inline int skb_is_gso(const struct sk_buff *skb) 1919static inline int skb_is_gso(const struct sk_buff *skb)
1868{ 1920{
1869 return skb_shinfo(skb)->gso_size; 1921 return skb_shinfo(skb)->gso_size;
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 000da12b5cf..f96d13c281e 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -253,9 +253,9 @@ static inline void *kmem_cache_alloc_node(struct kmem_cache *cachep,
253 * request comes from. 253 * request comes from.
254 */ 254 */
255#if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_SLUB) 255#if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_SLUB)
256extern void *__kmalloc_track_caller(size_t, gfp_t, void*); 256extern void *__kmalloc_track_caller(size_t, gfp_t, unsigned long);
257#define kmalloc_track_caller(size, flags) \ 257#define kmalloc_track_caller(size, flags) \
258 __kmalloc_track_caller(size, flags, __builtin_return_address(0)) 258 __kmalloc_track_caller(size, flags, _RET_IP_)
259#else 259#else
260#define kmalloc_track_caller(size, flags) \ 260#define kmalloc_track_caller(size, flags) \
261 __kmalloc(size, flags) 261 __kmalloc(size, flags)
@@ -271,10 +271,10 @@ extern void *__kmalloc_track_caller(size_t, gfp_t, void*);
271 * allocation request comes from. 271 * allocation request comes from.
272 */ 272 */
273#if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_SLUB) 273#if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_SLUB)
274extern void *__kmalloc_node_track_caller(size_t, gfp_t, int, void *); 274extern void *__kmalloc_node_track_caller(size_t, gfp_t, int, unsigned long);
275#define kmalloc_node_track_caller(size, flags, node) \ 275#define kmalloc_node_track_caller(size, flags, node) \
276 __kmalloc_node_track_caller(size, flags, node, \ 276 __kmalloc_node_track_caller(size, flags, node, \
277 __builtin_return_address(0)) 277 _RET_IP_)
278#else 278#else
279#define kmalloc_node_track_caller(size, flags, node) \ 279#define kmalloc_node_track_caller(size, flags, node) \
280 __kmalloc_node(size, flags, node) 280 __kmalloc_node(size, flags, node)
@@ -285,7 +285,7 @@ extern void *__kmalloc_node_track_caller(size_t, gfp_t, int, void *);
285#define kmalloc_node_track_caller(size, flags, node) \ 285#define kmalloc_node_track_caller(size, flags, node) \
286 kmalloc_track_caller(size, flags) 286 kmalloc_track_caller(size, flags)
287 287
288#endif /* DEBUG_SLAB */ 288#endif /* CONFIG_NUMA */
289 289
290/* 290/*
291 * Shortcuts 291 * Shortcuts
diff --git a/include/linux/smp.h b/include/linux/smp.h
index 6e7ba16ff45..b8246696810 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -21,6 +21,9 @@ struct call_single_data {
21 u16 priv; 21 u16 priv;
22}; 22};
23 23
24/* total number of cpus in this system (may exceed NR_CPUS) */
25extern unsigned int total_cpus;
26
24#ifdef CONFIG_SMP 27#ifdef CONFIG_SMP
25 28
26#include <linux/preempt.h> 29#include <linux/preempt.h>
@@ -64,15 +67,16 @@ extern void smp_cpus_done(unsigned int max_cpus);
64 * Call a function on all other processors 67 * Call a function on all other processors
65 */ 68 */
66int smp_call_function(void(*func)(void *info), void *info, int wait); 69int smp_call_function(void(*func)(void *info), void *info, int wait);
67/* Deprecated: use smp_call_function_many() which uses a cpumask ptr. */ 70void smp_call_function_many(const struct cpumask *mask,
68int smp_call_function_mask(cpumask_t mask, void(*func)(void *info), void *info, 71 void (*func)(void *info), void *info, bool wait);
69 int wait);
70 72
71static inline void smp_call_function_many(const struct cpumask *mask, 73/* Deprecated: Use smp_call_function_many which takes a pointer to the mask. */
72 void (*func)(void *info), void *info, 74static inline int
73 int wait) 75smp_call_function_mask(cpumask_t mask, void(*func)(void *info), void *info,
76 int wait)
74{ 77{
75 smp_call_function_mask(*mask, func, info, wait); 78 smp_call_function_many(&mask, func, info, wait);
79 return 0;
76} 80}
77 81
78int smp_call_function_single(int cpuid, void (*func) (void *info), void *info, 82int smp_call_function_single(int cpuid, void (*func) (void *info), void *info,
diff --git a/include/linux/smsc911x.h b/include/linux/smsc911x.h
new file mode 100644
index 00000000000..1cbf0313add
--- /dev/null
+++ b/include/linux/smsc911x.h
@@ -0,0 +1,47 @@
1/***************************************************************************
2 *
3 * Copyright (C) 2004-2008 SMSC
4 * Copyright (C) 2005-2008 ARM
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 *
20 ***************************************************************************/
21#ifndef __LINUX_SMSC911X_H__
22#define __LINUX_SMSC911X_H__
23
24#include <linux/phy.h>
25
26/* platform_device configuration data, should be assigned to
27 * the platform_device's dev.platform_data */
28struct smsc911x_platform_config {
29 unsigned int irq_polarity;
30 unsigned int irq_type;
31 unsigned int flags;
32 phy_interface_t phy_interface;
33};
34
35/* Constants for platform_device irq polarity configuration */
36#define SMSC911X_IRQ_POLARITY_ACTIVE_LOW 0
37#define SMSC911X_IRQ_POLARITY_ACTIVE_HIGH 1
38
39/* Constants for platform_device irq type configuration */
40#define SMSC911X_IRQ_TYPE_OPEN_DRAIN 0
41#define SMSC911X_IRQ_TYPE_PUSH_PULL 1
42
43/* Constants for flags */
44#define SMSC911X_USE_16BIT (BIT(0))
45#define SMSC911X_USE_32BIT (BIT(1))
46
47#endif /* __LINUX_SMSC911X_H__ */
diff --git a/include/linux/snmp.h b/include/linux/snmp.h
index 7a6e6bba4a7..aee3f1e1d1c 100644
--- a/include/linux/snmp.h
+++ b/include/linux/snmp.h
@@ -216,6 +216,9 @@ enum
216 LINUX_MIB_TCPSPURIOUSRTOS, /* TCPSpuriousRTOs */ 216 LINUX_MIB_TCPSPURIOUSRTOS, /* TCPSpuriousRTOs */
217 LINUX_MIB_TCPMD5NOTFOUND, /* TCPMD5NotFound */ 217 LINUX_MIB_TCPMD5NOTFOUND, /* TCPMD5NotFound */
218 LINUX_MIB_TCPMD5UNEXPECTED, /* TCPMD5Unexpected */ 218 LINUX_MIB_TCPMD5UNEXPECTED, /* TCPMD5Unexpected */
219 LINUX_MIB_SACKSHIFTED,
220 LINUX_MIB_SACKMERGED,
221 LINUX_MIB_SACKSHIFTFALLBACK,
219 __LINUX_MIB_MAX 222 __LINUX_MIB_MAX
220}; 223};
221 224
diff --git a/include/linux/stop_machine.h b/include/linux/stop_machine.h
index faf1519b5ad..74d59a64136 100644
--- a/include/linux/stop_machine.h
+++ b/include/linux/stop_machine.h
@@ -23,7 +23,7 @@
23 * 23 *
24 * This can be thought of as a very heavy write lock, equivalent to 24 * This can be thought of as a very heavy write lock, equivalent to
25 * grabbing every spinlock in the kernel. */ 25 * grabbing every spinlock in the kernel. */
26int stop_machine(int (*fn)(void *), void *data, const cpumask_t *cpus); 26int stop_machine(int (*fn)(void *), void *data, const struct cpumask *cpus);
27 27
28/** 28/**
29 * __stop_machine: freeze the machine on all CPUs and run this function 29 * __stop_machine: freeze the machine on all CPUs and run this function
@@ -34,11 +34,11 @@ int stop_machine(int (*fn)(void *), void *data, const cpumask_t *cpus);
34 * Description: This is a special version of the above, which assumes cpus 34 * Description: This is a special version of the above, which assumes cpus
35 * won't come or go while it's being called. Used by hotplug cpu. 35 * won't come or go while it's being called. Used by hotplug cpu.
36 */ 36 */
37int __stop_machine(int (*fn)(void *), void *data, const cpumask_t *cpus); 37int __stop_machine(int (*fn)(void *), void *data, const struct cpumask *cpus);
38#else 38#else
39 39
40static inline int stop_machine(int (*fn)(void *), void *data, 40static inline int stop_machine(int (*fn)(void *), void *data,
41 const cpumask_t *cpus) 41 const struct cpumask *cpus)
42{ 42{
43 int ret; 43 int ret;
44 local_irq_disable(); 44 local_irq_disable();
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index 6f0ee1b84a4..c39a21040dc 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -58,6 +58,7 @@ struct rpc_clnt {
58 struct rpc_timeout cl_timeout_default; 58 struct rpc_timeout cl_timeout_default;
59 struct rpc_program * cl_program; 59 struct rpc_program * cl_program;
60 char cl_inline_name[32]; 60 char cl_inline_name[32];
61 char *cl_principal; /* target to authenticate to */
61}; 62};
62 63
63/* 64/*
@@ -108,6 +109,7 @@ struct rpc_create_args {
108 u32 version; 109 u32 version;
109 rpc_authflavor_t authflavor; 110 rpc_authflavor_t authflavor;
110 unsigned long flags; 111 unsigned long flags;
112 char *client_name;
111}; 113};
112 114
113/* Values for "flags" field */ 115/* Values for "flags" field */
diff --git a/include/linux/sunrpc/rpc_pipe_fs.h b/include/linux/sunrpc/rpc_pipe_fs.h
index 51b977a4ca2..cea764c2359 100644
--- a/include/linux/sunrpc/rpc_pipe_fs.h
+++ b/include/linux/sunrpc/rpc_pipe_fs.h
@@ -15,6 +15,7 @@ struct rpc_pipe_ops {
15 ssize_t (*upcall)(struct file *, struct rpc_pipe_msg *, char __user *, size_t); 15 ssize_t (*upcall)(struct file *, struct rpc_pipe_msg *, char __user *, size_t);
16 ssize_t (*downcall)(struct file *, const char __user *, size_t); 16 ssize_t (*downcall)(struct file *, const char __user *, size_t);
17 void (*release_pipe)(struct inode *); 17 void (*release_pipe)(struct inode *);
18 int (*open_pipe)(struct inode *);
18 void (*destroy_msg)(struct rpc_pipe_msg *); 19 void (*destroy_msg)(struct rpc_pipe_msg *);
19}; 20};
20 21
diff --git a/include/linux/sunrpc/svc_xprt.h b/include/linux/sunrpc/svc_xprt.h
index 6fd7b016517..0127daca435 100644
--- a/include/linux/sunrpc/svc_xprt.h
+++ b/include/linux/sunrpc/svc_xprt.h
@@ -139,14 +139,14 @@ static inline char *__svc_print_addr(struct sockaddr *addr,
139{ 139{
140 switch (addr->sa_family) { 140 switch (addr->sa_family) {
141 case AF_INET: 141 case AF_INET:
142 snprintf(buf, len, "%u.%u.%u.%u, port=%u", 142 snprintf(buf, len, "%pI4, port=%u",
143 NIPQUAD(((struct sockaddr_in *) addr)->sin_addr), 143 &((struct sockaddr_in *)addr)->sin_addr,
144 ntohs(((struct sockaddr_in *) addr)->sin_port)); 144 ntohs(((struct sockaddr_in *) addr)->sin_port));
145 break; 145 break;
146 146
147 case AF_INET6: 147 case AF_INET6:
148 snprintf(buf, len, "%x:%x:%x:%x:%x:%x:%x:%x, port=%u", 148 snprintf(buf, len, "%pI6, port=%u",
149 NIP6(((struct sockaddr_in6 *) addr)->sin6_addr), 149 &((struct sockaddr_in6 *)addr)->sin6_addr,
150 ntohs(((struct sockaddr_in6 *) addr)->sin6_port)); 150 ntohs(((struct sockaddr_in6 *) addr)->sin6_port));
151 break; 151 break;
152 152
diff --git a/include/linux/sunrpc/svcauth_gss.h b/include/linux/sunrpc/svcauth_gss.h
index c9165d9771a..ca7d725861f 100644
--- a/include/linux/sunrpc/svcauth_gss.h
+++ b/include/linux/sunrpc/svcauth_gss.h
@@ -20,6 +20,7 @@ int gss_svc_init(void);
20void gss_svc_shutdown(void); 20void gss_svc_shutdown(void);
21int svcauth_gss_register_pseudoflavor(u32 pseudoflavor, char * name); 21int svcauth_gss_register_pseudoflavor(u32 pseudoflavor, char * name);
22u32 svcauth_gss_flavor(struct auth_domain *dom); 22u32 svcauth_gss_flavor(struct auth_domain *dom);
23char *svc_gss_principal(struct svc_rqst *);
23 24
24#endif /* __KERNEL__ */ 25#endif /* __KERNEL__ */
25#endif /* _LINUX_SUNRPC_SVCAUTH_GSS_H */ 26#endif /* _LINUX_SUNRPC_SVCAUTH_GSS_H */
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h
index e4057d729f0..49e1eb45446 100644
--- a/include/linux/sunrpc/xdr.h
+++ b/include/linux/sunrpc/xdr.h
@@ -37,21 +37,6 @@ struct xdr_netobj {
37typedef int (*kxdrproc_t)(void *rqstp, __be32 *data, void *obj); 37typedef int (*kxdrproc_t)(void *rqstp, __be32 *data, void *obj);
38 38
39/* 39/*
40 * We're still requiring the BKL in the xdr code until it's been
41 * more carefully audited, at which point this wrapper will become
42 * unnecessary.
43 */
44static inline int rpc_call_xdrproc(kxdrproc_t xdrproc, void *rqstp, __be32 *data, void *obj)
45{
46 int ret;
47
48 lock_kernel();
49 ret = xdrproc(rqstp, data, obj);
50 unlock_kernel();
51 return ret;
52}
53
54/*
55 * Basic structure for transmission/reception of a client XDR message. 40 * Basic structure for transmission/reception of a client XDR message.
56 * Features a header (for a linear buffer containing RPC headers 41 * Features a header (for a linear buffer containing RPC headers
57 * and the data payload for short messages), and then an array of 42 * and the data payload for short messages), and then an array of
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index 4d80a118d53..11fc71d50c1 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -76,8 +76,7 @@ struct rpc_rqst {
76 struct list_head rq_list; 76 struct list_head rq_list;
77 77
78 __u32 * rq_buffer; /* XDR encode buffer */ 78 __u32 * rq_buffer; /* XDR encode buffer */
79 size_t rq_bufsize, 79 size_t rq_callsize,
80 rq_callsize,
81 rq_rcvsize; 80 rq_rcvsize;
82 81
83 struct xdr_buf rq_private_buf; /* The receive buffer 82 struct xdr_buf rq_private_buf; /* The receive buffer
diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h
index b18ec5533e8..325af1de035 100644
--- a/include/linux/swiotlb.h
+++ b/include/linux/swiotlb.h
@@ -7,9 +7,31 @@ struct device;
7struct dma_attrs; 7struct dma_attrs;
8struct scatterlist; 8struct scatterlist;
9 9
10/*
11 * Maximum allowable number of contiguous slabs to map,
12 * must be a power of 2. What is the appropriate value ?
13 * The complexity of {map,unmap}_single is linearly dependent on this value.
14 */
15#define IO_TLB_SEGSIZE 128
16
17
18/*
19 * log of the size of each IO TLB slab. The number of slabs is command line
20 * controllable.
21 */
22#define IO_TLB_SHIFT 11
23
10extern void 24extern void
11swiotlb_init(void); 25swiotlb_init(void);
12 26
27extern void *swiotlb_alloc_boot(size_t bytes, unsigned long nslabs);
28extern void *swiotlb_alloc(unsigned order, unsigned long nslabs);
29
30extern dma_addr_t swiotlb_phys_to_bus(phys_addr_t address);
31extern phys_addr_t swiotlb_bus_to_phys(dma_addr_t address);
32
33extern int swiotlb_arch_range_needs_mapping(void *ptr, size_t size);
34
13extern void 35extern void
14*swiotlb_alloc_coherent(struct device *hwdev, size_t size, 36*swiotlb_alloc_coherent(struct device *hwdev, size_t size,
15 dma_addr_t *dma_handle, gfp_t flags); 37 dma_addr_t *dma_handle, gfp_t flags);
diff --git a/include/linux/threads.h b/include/linux/threads.h
index 38d1a5d6568..052b12bec8b 100644
--- a/include/linux/threads.h
+++ b/include/linux/threads.h
@@ -8,17 +8,17 @@
8 */ 8 */
9 9
10/* 10/*
11 * Maximum supported processors that can run under SMP. This value is 11 * Maximum supported processors. Setting this smaller saves quite a
12 * set via configure setting. The maximum is equal to the size of the 12 * bit of memory. Use nr_cpu_ids instead of this except for static bitmaps.
13 * bitmasks used on that platform, i.e. 32 or 64. Setting this smaller
14 * saves quite a bit of memory.
15 */ 13 */
16#ifdef CONFIG_SMP 14#ifndef CONFIG_NR_CPUS
17#define NR_CPUS CONFIG_NR_CPUS 15/* FIXME: This should be fixed in the arch's Kconfig */
18#else 16#define CONFIG_NR_CPUS 1
19#define NR_CPUS 1
20#endif 17#endif
21 18
19/* Places which use this should consider cpumask_var_t. */
20#define NR_CPUS CONFIG_NR_CPUS
21
22#define MIN_THREADS_LEFT_FOR_ROOT 4 22#define MIN_THREADS_LEFT_FOR_ROOT 4
23 23
24/* 24/*
diff --git a/include/linux/tick.h b/include/linux/tick.h
index b6ec8189ac0..469b82d88b3 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -84,10 +84,10 @@ static inline void tick_cancel_sched_timer(int cpu) { }
84 84
85# ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST 85# ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
86extern struct tick_device *tick_get_broadcast_device(void); 86extern struct tick_device *tick_get_broadcast_device(void);
87extern cpumask_t *tick_get_broadcast_mask(void); 87extern struct cpumask *tick_get_broadcast_mask(void);
88 88
89# ifdef CONFIG_TICK_ONESHOT 89# ifdef CONFIG_TICK_ONESHOT
90extern cpumask_t *tick_get_broadcast_oneshot_mask(void); 90extern struct cpumask *tick_get_broadcast_oneshot_mask(void);
91# endif 91# endif
92 92
93# endif /* BROADCAST */ 93# endif /* BROADCAST */
diff --git a/include/linux/timex.h b/include/linux/timex.h
index 9007313b5b7..998a55d80ac 100644
--- a/include/linux/timex.h
+++ b/include/linux/timex.h
@@ -53,47 +53,11 @@
53#ifndef _LINUX_TIMEX_H 53#ifndef _LINUX_TIMEX_H
54#define _LINUX_TIMEX_H 54#define _LINUX_TIMEX_H
55 55
56#include <linux/compiler.h>
57#include <linux/time.h> 56#include <linux/time.h>
58 57
59#include <asm/param.h>
60
61#define NTP_API 4 /* NTP API version */ 58#define NTP_API 4 /* NTP API version */
62 59
63/* 60/*
64 * SHIFT_KG and SHIFT_KF establish the damping of the PLL and are chosen
65 * for a slightly underdamped convergence characteristic. SHIFT_KH
66 * establishes the damping of the FLL and is chosen by wisdom and black
67 * art.
68 *
69 * MAXTC establishes the maximum time constant of the PLL. With the
70 * SHIFT_KG and SHIFT_KF values given and a time constant range from
71 * zero to MAXTC, the PLL will converge in 15 minutes to 16 hours,
72 * respectively.
73 */
74#define SHIFT_PLL 4 /* PLL frequency factor (shift) */
75#define SHIFT_FLL 2 /* FLL frequency factor (shift) */
76#define MAXTC 10 /* maximum time constant (shift) */
77
78/*
79 * SHIFT_USEC defines the scaling (shift) of the time_freq and
80 * time_tolerance variables, which represent the current frequency
81 * offset and maximum frequency tolerance.
82 */
83#define SHIFT_USEC 16 /* frequency offset scale (shift) */
84#define PPM_SCALE (NSEC_PER_USEC << (NTP_SCALE_SHIFT - SHIFT_USEC))
85#define PPM_SCALE_INV_SHIFT 19
86#define PPM_SCALE_INV ((1ll << (PPM_SCALE_INV_SHIFT + NTP_SCALE_SHIFT)) / \
87 PPM_SCALE + 1)
88
89#define MAXPHASE 500000000l /* max phase error (ns) */
90#define MAXFREQ 500000 /* max frequency error (ns/s) */
91#define MAXFREQ_SCALED ((s64)MAXFREQ << NTP_SCALE_SHIFT)
92#define MINSEC 256 /* min interval between updates (s) */
93#define MAXSEC 2048 /* max interval between updates (s) */
94#define NTP_PHASE_LIMIT ((MAXPHASE / NSEC_PER_USEC) << 5) /* beyond max. dispersion */
95
96/*
97 * syscall interface - used (mainly by NTP daemon) 61 * syscall interface - used (mainly by NTP daemon)
98 * to discipline kernel clock oscillator 62 * to discipline kernel clock oscillator
99 */ 63 */
@@ -199,9 +163,46 @@ struct timex {
199#define TIME_BAD TIME_ERROR /* bw compat */ 163#define TIME_BAD TIME_ERROR /* bw compat */
200 164
201#ifdef __KERNEL__ 165#ifdef __KERNEL__
166#include <linux/compiler.h>
167#include <linux/types.h>
168#include <linux/param.h>
169
202#include <asm/timex.h> 170#include <asm/timex.h>
203 171
204/* 172/*
173 * SHIFT_KG and SHIFT_KF establish the damping of the PLL and are chosen
174 * for a slightly underdamped convergence characteristic. SHIFT_KH
175 * establishes the damping of the FLL and is chosen by wisdom and black
176 * art.
177 *
178 * MAXTC establishes the maximum time constant of the PLL. With the
179 * SHIFT_KG and SHIFT_KF values given and a time constant range from
180 * zero to MAXTC, the PLL will converge in 15 minutes to 16 hours,
181 * respectively.
182 */
183#define SHIFT_PLL 4 /* PLL frequency factor (shift) */
184#define SHIFT_FLL 2 /* FLL frequency factor (shift) */
185#define MAXTC 10 /* maximum time constant (shift) */
186
187/*
188 * SHIFT_USEC defines the scaling (shift) of the time_freq and
189 * time_tolerance variables, which represent the current frequency
190 * offset and maximum frequency tolerance.
191 */
192#define SHIFT_USEC 16 /* frequency offset scale (shift) */
193#define PPM_SCALE (NSEC_PER_USEC << (NTP_SCALE_SHIFT - SHIFT_USEC))
194#define PPM_SCALE_INV_SHIFT 19
195#define PPM_SCALE_INV ((1ll << (PPM_SCALE_INV_SHIFT + NTP_SCALE_SHIFT)) / \
196 PPM_SCALE + 1)
197
198#define MAXPHASE 500000000l /* max phase error (ns) */
199#define MAXFREQ 500000 /* max frequency error (ns/s) */
200#define MAXFREQ_SCALED ((s64)MAXFREQ << NTP_SCALE_SHIFT)
201#define MINSEC 256 /* min interval between updates (s) */
202#define MAXSEC 2048 /* max interval between updates (s) */
203#define NTP_PHASE_LIMIT ((MAXPHASE / NSEC_PER_USEC) << 5) /* beyond max. dispersion */
204
205/*
205 * kernel variables 206 * kernel variables
206 * Note: maximum error = NTP synch distance = dispersion + delay / 2; 207 * Note: maximum error = NTP synch distance = dispersion + delay / 2;
207 * estimated error = NTP dispersion. 208 * estimated error = NTP dispersion.
diff --git a/include/linux/tty.h b/include/linux/tty.h
index eaec37c9d83..3f4954c55e5 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -442,6 +442,7 @@ extern void tty_audit_add_data(struct tty_struct *tty, unsigned char *data,
442 size_t size); 442 size_t size);
443extern void tty_audit_exit(void); 443extern void tty_audit_exit(void);
444extern void tty_audit_fork(struct signal_struct *sig); 444extern void tty_audit_fork(struct signal_struct *sig);
445extern void tty_audit_tiocsti(struct tty_struct *tty, char ch);
445extern void tty_audit_push(struct tty_struct *tty); 446extern void tty_audit_push(struct tty_struct *tty);
446extern void tty_audit_push_task(struct task_struct *tsk, 447extern void tty_audit_push_task(struct task_struct *tsk,
447 uid_t loginuid, u32 sessionid); 448 uid_t loginuid, u32 sessionid);
@@ -450,6 +451,9 @@ static inline void tty_audit_add_data(struct tty_struct *tty,
450 unsigned char *data, size_t size) 451 unsigned char *data, size_t size)
451{ 452{
452} 453}
454static inline void tty_audit_tiocsti(struct tty_struct *tty, char ch)
455{
456}
453static inline void tty_audit_exit(void) 457static inline void tty_audit_exit(void)
454{ 458{
455} 459}
diff --git a/include/linux/types.h b/include/linux/types.h
index 1d98330b1f2..121f349cb7e 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -135,19 +135,14 @@ typedef __s64 int64_t;
135 * 135 *
136 * Linux always considers sectors to be 512 bytes long independently 136 * Linux always considers sectors to be 512 bytes long independently
137 * of the devices real block size. 137 * of the devices real block size.
138 *
139 * blkcnt_t is the type of the inode's block count.
138 */ 140 */
139#ifdef CONFIG_LBD 141#ifdef CONFIG_LBD
140typedef u64 sector_t; 142typedef u64 sector_t;
141#else
142typedef unsigned long sector_t;
143#endif
144
145/*
146 * The type of the inode's block count.
147 */
148#ifdef CONFIG_LSF
149typedef u64 blkcnt_t; 143typedef u64 blkcnt_t;
150#else 144#else
145typedef unsigned long sector_t;
151typedef unsigned long blkcnt_t; 146typedef unsigned long blkcnt_t;
152#endif 147#endif
153 148
diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h
index b5f41d4c2ee..315bcd37522 100644
--- a/include/linux/user_namespace.h
+++ b/include/linux/user_namespace.h
@@ -12,7 +12,7 @@
12struct user_namespace { 12struct user_namespace {
13 struct kref kref; 13 struct kref kref;
14 struct hlist_head uidhash_table[UIDHASH_SZ]; 14 struct hlist_head uidhash_table[UIDHASH_SZ];
15 struct user_struct *root_user; 15 struct user_struct *creator;
16}; 16};
17 17
18extern struct user_namespace init_user_ns; 18extern struct user_namespace init_user_ns;
@@ -26,8 +26,7 @@ static inline struct user_namespace *get_user_ns(struct user_namespace *ns)
26 return ns; 26 return ns;
27} 27}
28 28
29extern struct user_namespace *copy_user_ns(int flags, 29extern int create_user_ns(struct cred *new);
30 struct user_namespace *old_ns);
31extern void free_user_ns(struct kref *kref); 30extern void free_user_ns(struct kref *kref);
32 31
33static inline void put_user_ns(struct user_namespace *ns) 32static inline void put_user_ns(struct user_namespace *ns)
@@ -43,13 +42,9 @@ static inline struct user_namespace *get_user_ns(struct user_namespace *ns)
43 return &init_user_ns; 42 return &init_user_ns;
44} 43}
45 44
46static inline struct user_namespace *copy_user_ns(int flags, 45static inline int create_user_ns(struct cred *new)
47 struct user_namespace *old_ns)
48{ 46{
49 if (flags & CLONE_NEWUSER) 47 return -EINVAL;
50 return ERR_PTR(-EINVAL);
51
52 return old_ns;
53} 48}
54 49
55static inline void put_user_ns(struct user_namespace *ns) 50static inline void put_user_ns(struct user_namespace *ns)
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 4669d7e72e7..1f126e30766 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -293,6 +293,7 @@ struct v4l2_pix_format {
293#define V4L2_PIX_FMT_YVU420 v4l2_fourcc('Y', 'V', '1', '2') /* 12 YVU 4:2:0 */ 293#define V4L2_PIX_FMT_YVU420 v4l2_fourcc('Y', 'V', '1', '2') /* 12 YVU 4:2:0 */
294#define V4L2_PIX_FMT_YUYV v4l2_fourcc('Y', 'U', 'Y', 'V') /* 16 YUV 4:2:2 */ 294#define V4L2_PIX_FMT_YUYV v4l2_fourcc('Y', 'U', 'Y', 'V') /* 16 YUV 4:2:2 */
295#define V4L2_PIX_FMT_UYVY v4l2_fourcc('U', 'Y', 'V', 'Y') /* 16 YUV 4:2:2 */ 295#define V4L2_PIX_FMT_UYVY v4l2_fourcc('U', 'Y', 'V', 'Y') /* 16 YUV 4:2:2 */
296#define V4L2_PIX_FMT_VYUY v4l2_fourcc('V', 'Y', 'U', 'Y') /* 16 YUV 4:2:2 */
296#define V4L2_PIX_FMT_YUV422P v4l2_fourcc('4', '2', '2', 'P') /* 16 YVU422 planar */ 297#define V4L2_PIX_FMT_YUV422P v4l2_fourcc('4', '2', '2', 'P') /* 16 YVU422 planar */
297#define V4L2_PIX_FMT_YUV411P v4l2_fourcc('4', '1', '1', 'P') /* 16 YVU411 planar */ 298#define V4L2_PIX_FMT_YUV411P v4l2_fourcc('4', '1', '1', 'P') /* 16 YVU411 planar */
298#define V4L2_PIX_FMT_Y41P v4l2_fourcc('Y', '4', '1', 'P') /* 12 YUV 4:1:1 */ 299#define V4L2_PIX_FMT_Y41P v4l2_fourcc('Y', '4', '1', 'P') /* 12 YUV 4:1:1 */
@@ -304,6 +305,8 @@ struct v4l2_pix_format {
304/* two planes -- one Y, one Cr + Cb interleaved */ 305/* two planes -- one Y, one Cr + Cb interleaved */
305#define V4L2_PIX_FMT_NV12 v4l2_fourcc('N', 'V', '1', '2') /* 12 Y/CbCr 4:2:0 */ 306#define V4L2_PIX_FMT_NV12 v4l2_fourcc('N', 'V', '1', '2') /* 12 Y/CbCr 4:2:0 */
306#define V4L2_PIX_FMT_NV21 v4l2_fourcc('N', 'V', '2', '1') /* 12 Y/CrCb 4:2:0 */ 307#define V4L2_PIX_FMT_NV21 v4l2_fourcc('N', 'V', '2', '1') /* 12 Y/CrCb 4:2:0 */
308#define V4L2_PIX_FMT_NV16 v4l2_fourcc('N', 'V', '1', '6') /* 16 Y/CbCr 4:2:2 */
309#define V4L2_PIX_FMT_NV61 v4l2_fourcc('N', 'V', '6', '1') /* 16 Y/CrCb 4:2:2 */
307 310
308/* The following formats are not defined in the V4L2 specification */ 311/* The following formats are not defined in the V4L2 specification */
309#define V4L2_PIX_FMT_YUV410 v4l2_fourcc('Y', 'U', 'V', '9') /* 9 YUV 4:1:0 */ 312#define V4L2_PIX_FMT_YUV410 v4l2_fourcc('Y', 'U', 'V', '9') /* 9 YUV 4:1:0 */
@@ -1050,7 +1053,7 @@ enum v4l2_mpeg_video_bitrate_mode {
1050#define V4L2_CID_MPEG_VIDEO_MUTE (V4L2_CID_MPEG_BASE+210) 1053#define V4L2_CID_MPEG_VIDEO_MUTE (V4L2_CID_MPEG_BASE+210)
1051#define V4L2_CID_MPEG_VIDEO_MUTE_YUV (V4L2_CID_MPEG_BASE+211) 1054#define V4L2_CID_MPEG_VIDEO_MUTE_YUV (V4L2_CID_MPEG_BASE+211)
1052 1055
1053/* MPEG-class control IDs specific to the CX2584x driver as defined by V4L2 */ 1056/* MPEG-class control IDs specific to the CX2341x driver as defined by V4L2 */
1054#define V4L2_CID_MPEG_CX2341X_BASE (V4L2_CTRL_CLASS_MPEG | 0x1000) 1057#define V4L2_CID_MPEG_CX2341X_BASE (V4L2_CTRL_CLASS_MPEG | 0x1000)
1055#define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE (V4L2_CID_MPEG_CX2341X_BASE+0) 1058#define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE (V4L2_CID_MPEG_CX2341X_BASE+0)
1056enum v4l2_mpeg_cx2341x_video_spatial_filter_mode { 1059enum v4l2_mpeg_cx2341x_video_spatial_filter_mode {
@@ -1117,6 +1120,12 @@ enum v4l2_exposure_auto_type {
1117#define V4L2_CID_FOCUS_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+11) 1120#define V4L2_CID_FOCUS_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+11)
1118#define V4L2_CID_FOCUS_AUTO (V4L2_CID_CAMERA_CLASS_BASE+12) 1121#define V4L2_CID_FOCUS_AUTO (V4L2_CID_CAMERA_CLASS_BASE+12)
1119 1122
1123#define V4L2_CID_ZOOM_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+13)
1124#define V4L2_CID_ZOOM_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+14)
1125#define V4L2_CID_ZOOM_CONTINUOUS (V4L2_CID_CAMERA_CLASS_BASE+15)
1126
1127#define V4L2_CID_PRIVACY (V4L2_CID_CAMERA_CLASS_BASE+16)
1128
1120/* 1129/*
1121 * T U N I N G 1130 * T U N I N G
1122 */ 1131 */
@@ -1369,6 +1378,7 @@ struct v4l2_streamparm {
1369#define V4L2_CHIP_MATCH_HOST 0 /* Match against chip ID on host (0 for the host) */ 1378#define V4L2_CHIP_MATCH_HOST 0 /* Match against chip ID on host (0 for the host) */
1370#define V4L2_CHIP_MATCH_I2C_DRIVER 1 /* Match against I2C driver ID */ 1379#define V4L2_CHIP_MATCH_I2C_DRIVER 1 /* Match against I2C driver ID */
1371#define V4L2_CHIP_MATCH_I2C_ADDR 2 /* Match against I2C 7-bit address */ 1380#define V4L2_CHIP_MATCH_I2C_ADDR 2 /* Match against I2C 7-bit address */
1381#define V4L2_CHIP_MATCH_AC97 3 /* Match against anciliary AC97 chip */
1372 1382
1373struct v4l2_register { 1383struct v4l2_register {
1374 __u32 match_type; /* Match type */ 1384 __u32 match_type; /* Match type */
@@ -1458,6 +1468,8 @@ struct v4l2_chip_ident {
1458#define VIDIOC_G_CHIP_IDENT _IOWR('V', 81, struct v4l2_chip_ident) 1468#define VIDIOC_G_CHIP_IDENT _IOWR('V', 81, struct v4l2_chip_ident)
1459#endif 1469#endif
1460#define VIDIOC_S_HW_FREQ_SEEK _IOW('V', 82, struct v4l2_hw_freq_seek) 1470#define VIDIOC_S_HW_FREQ_SEEK _IOW('V', 82, struct v4l2_hw_freq_seek)
1471/* Reminder: when adding new ioctls please add support for them to
1472 drivers/media/video/v4l2-compat-ioctl32.c as well! */
1461 1473
1462#ifdef __OLD_VIDIOC_ 1474#ifdef __OLD_VIDIOC_
1463/* for compatibility, will go away some day */ 1475/* for compatibility, will go away some day */
diff --git a/include/linux/virtio_balloon.h b/include/linux/virtio_balloon.h
index c30c7bfbf39..8726ff77763 100644
--- a/include/linux/virtio_balloon.h
+++ b/include/linux/virtio_balloon.h
@@ -10,6 +10,9 @@
10/* The feature bitmap for virtio balloon */ 10/* The feature bitmap for virtio balloon */
11#define VIRTIO_BALLOON_F_MUST_TELL_HOST 0 /* Tell before reclaiming pages */ 11#define VIRTIO_BALLOON_F_MUST_TELL_HOST 0 /* Tell before reclaiming pages */
12 12
13/* Size of a PFN in the balloon interface. */
14#define VIRTIO_BALLOON_PFN_SHIFT 12
15
13struct virtio_balloon_config 16struct virtio_balloon_config
14{ 17{
15 /* Number of pages host wants Guest to give up. */ 18 /* Number of pages host wants Guest to give up. */
diff --git a/include/linux/virtio_console.h b/include/linux/virtio_console.h
index 19a0da0dba4..7615ffcdd55 100644
--- a/include/linux/virtio_console.h
+++ b/include/linux/virtio_console.h
@@ -7,6 +7,17 @@
7/* The ID for virtio console */ 7/* The ID for virtio console */
8#define VIRTIO_ID_CONSOLE 3 8#define VIRTIO_ID_CONSOLE 3
9 9
10/* Feature bits */
11#define VIRTIO_CONSOLE_F_SIZE 0 /* Does host provide console size? */
12
13struct virtio_console_config {
14 /* colums of the screens */
15 __u16 cols;
16 /* rows of the screens */
17 __u16 rows;
18} __attribute__((packed));
19
20
10#ifdef __KERNEL__ 21#ifdef __KERNEL__
11int __init virtio_cons_early_init(int (*put_chars)(u32, const char *, int)); 22int __init virtio_cons_early_init(int (*put_chars)(u32, const char *, int));
12#endif /* __KERNEL__ */ 23#endif /* __KERNEL__ */
diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h
index 5e33761b9b8..5cdd0aa8bde 100644
--- a/include/linux/virtio_net.h
+++ b/include/linux/virtio_net.h
@@ -20,6 +20,7 @@
20#define VIRTIO_NET_F_HOST_TSO6 12 /* Host can handle TSOv6 in. */ 20#define VIRTIO_NET_F_HOST_TSO6 12 /* Host can handle TSOv6 in. */
21#define VIRTIO_NET_F_HOST_ECN 13 /* Host can handle TSO[6] w/ ECN in. */ 21#define VIRTIO_NET_F_HOST_ECN 13 /* Host can handle TSO[6] w/ ECN in. */
22#define VIRTIO_NET_F_HOST_UFO 14 /* Host can handle UFO in. */ 22#define VIRTIO_NET_F_HOST_UFO 14 /* Host can handle UFO in. */
23#define VIRTIO_NET_F_MRG_RXBUF 15 /* Host can merge receive buffers. */
23 24
24struct virtio_net_config 25struct virtio_net_config
25{ 26{
@@ -44,4 +45,12 @@ struct virtio_net_hdr
44 __u16 csum_start; /* Position to start checksumming from */ 45 __u16 csum_start; /* Position to start checksumming from */
45 __u16 csum_offset; /* Offset after that to place checksum */ 46 __u16 csum_offset; /* Offset after that to place checksum */
46}; 47};
48
49/* This is the version of the header to use when the MRG_RXBUF
50 * feature has been negotiated. */
51struct virtio_net_hdr_mrg_rxbuf {
52 struct virtio_net_hdr hdr;
53 __u16 num_buffers; /* Number of merged rx buffers */
54};
55
47#endif /* _LINUX_VIRTIO_NET_H */ 56#endif /* _LINUX_VIRTIO_NET_H */
diff --git a/include/linux/virtio_pci.h b/include/linux/virtio_pci.h
index cdef3574293..cd0fd5d181a 100644
--- a/include/linux/virtio_pci.h
+++ b/include/linux/virtio_pci.h
@@ -53,4 +53,12 @@
53 53
54/* Virtio ABI version, this must match exactly */ 54/* Virtio ABI version, this must match exactly */
55#define VIRTIO_PCI_ABI_VERSION 0 55#define VIRTIO_PCI_ABI_VERSION 0
56
57/* How many bits to shift physical queue address written to QUEUE_PFN.
58 * 12 is historical, and due to x86 page size. */
59#define VIRTIO_PCI_QUEUE_ADDR_SHIFT 12
60
61/* The alignment to use between consumer and producer parts of vring.
62 * x86 pagesize again. */
63#define VIRTIO_PCI_VRING_ALIGN 4096
56#endif 64#endif
diff --git a/include/linux/virtio_ring.h b/include/linux/virtio_ring.h
index c4a598fb382..71e03722fb5 100644
--- a/include/linux/virtio_ring.h
+++ b/include/linux/virtio_ring.h
@@ -83,7 +83,7 @@ struct vring {
83 * __u16 avail_idx; 83 * __u16 avail_idx;
84 * __u16 available[num]; 84 * __u16 available[num];
85 * 85 *
86 * // Padding to the next page boundary. 86 * // Padding to the next align boundary.
87 * char pad[]; 87 * char pad[];
88 * 88 *
89 * // A ring of used descriptor heads with free-running index. 89 * // A ring of used descriptor heads with free-running index.
@@ -93,19 +93,19 @@ struct vring {
93 * }; 93 * };
94 */ 94 */
95static inline void vring_init(struct vring *vr, unsigned int num, void *p, 95static inline void vring_init(struct vring *vr, unsigned int num, void *p,
96 unsigned long pagesize) 96 unsigned long align)
97{ 97{
98 vr->num = num; 98 vr->num = num;
99 vr->desc = p; 99 vr->desc = p;
100 vr->avail = p + num*sizeof(struct vring_desc); 100 vr->avail = p + num*sizeof(struct vring_desc);
101 vr->used = (void *)(((unsigned long)&vr->avail->ring[num] + pagesize-1) 101 vr->used = (void *)(((unsigned long)&vr->avail->ring[num] + align-1)
102 & ~(pagesize - 1)); 102 & ~(align - 1));
103} 103}
104 104
105static inline unsigned vring_size(unsigned int num, unsigned long pagesize) 105static inline unsigned vring_size(unsigned int num, unsigned long align)
106{ 106{
107 return ((sizeof(struct vring_desc) * num + sizeof(__u16) * (2 + num) 107 return ((sizeof(struct vring_desc) * num + sizeof(__u16) * (2 + num)
108 + pagesize - 1) & ~(pagesize - 1)) 108 + align - 1) & ~(align - 1))
109 + sizeof(__u16) * 2 + sizeof(struct vring_used_elem) * num; 109 + sizeof(__u16) * 2 + sizeof(struct vring_used_elem) * num;
110} 110}
111 111
@@ -115,6 +115,7 @@ struct virtio_device;
115struct virtqueue; 115struct virtqueue;
116 116
117struct virtqueue *vring_new_virtqueue(unsigned int num, 117struct virtqueue *vring_new_virtqueue(unsigned int num,
118 unsigned int vring_align,
118 struct virtio_device *vdev, 119 struct virtio_device *vdev,
119 void *pages, 120 void *pages,
120 void (*notify)(struct virtqueue *vq), 121 void (*notify)(struct virtqueue *vq),
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h
index 4bc1e6b86cb..52f3abd453a 100644
--- a/include/linux/xfrm.h
+++ b/include/linux/xfrm.h
@@ -199,6 +199,9 @@ enum {
199#define XFRM_MSG_NEWSPDINFO XFRM_MSG_NEWSPDINFO 199#define XFRM_MSG_NEWSPDINFO XFRM_MSG_NEWSPDINFO
200 XFRM_MSG_GETSPDINFO, 200 XFRM_MSG_GETSPDINFO,
201#define XFRM_MSG_GETSPDINFO XFRM_MSG_GETSPDINFO 201#define XFRM_MSG_GETSPDINFO XFRM_MSG_GETSPDINFO
202
203 XFRM_MSG_MAPPING,
204#define XFRM_MSG_MAPPING XFRM_MSG_MAPPING
202 __XFRM_MSG_MAX 205 __XFRM_MSG_MAX
203}; 206};
204#define XFRM_MSG_MAX (__XFRM_MSG_MAX - 1) 207#define XFRM_MSG_MAX (__XFRM_MSG_MAX - 1)
@@ -438,6 +441,15 @@ struct xfrm_user_migrate {
438 __u16 new_family; 441 __u16 new_family;
439}; 442};
440 443
444struct xfrm_user_mapping {
445 struct xfrm_usersa_id id;
446 __u32 reqid;
447 xfrm_address_t old_saddr;
448 xfrm_address_t new_saddr;
449 __be16 old_sport;
450 __be16 new_sport;
451};
452
441#ifndef __KERNEL__ 453#ifndef __KERNEL__
442/* backwards compatibility for userspace */ 454/* backwards compatibility for userspace */
443#define XFRMGRP_ACQUIRE 1 455#define XFRMGRP_ACQUIRE 1
@@ -464,6 +476,8 @@ enum xfrm_nlgroups {
464#define XFRMNLGRP_REPORT XFRMNLGRP_REPORT 476#define XFRMNLGRP_REPORT XFRMNLGRP_REPORT
465 XFRMNLGRP_MIGRATE, 477 XFRMNLGRP_MIGRATE,
466#define XFRMNLGRP_MIGRATE XFRMNLGRP_MIGRATE 478#define XFRMNLGRP_MIGRATE XFRMNLGRP_MIGRATE
479 XFRMNLGRP_MAPPING,
480#define XFRMNLGRP_MAPPING XFRMNLGRP_MAPPING
467 __XFRMNLGRP_MAX 481 __XFRMNLGRP_MAX
468}; 482};
469#define XFRMNLGRP_MAX (__XFRMNLGRP_MAX - 1) 483#define XFRMNLGRP_MAX (__XFRMNLGRP_MAX - 1)
diff --git a/include/media/i2c-addr.h b/include/media/i2c-addr.h
index e7ff44a35ca..5d0f56054d2 100644
--- a/include/media/i2c-addr.h
+++ b/include/media/i2c-addr.h
@@ -12,8 +12,6 @@
12/* bttv address list */ 12/* bttv address list */
13#define I2C_ADDR_TSA5522 0xc2 13#define I2C_ADDR_TSA5522 0xc2
14#define I2C_ADDR_TDA7432 0x8a 14#define I2C_ADDR_TDA7432 0x8a
15#define I2C_ADDR_BT832_ALT1 0x88
16#define I2C_ADDR_BT832_ALT2 0x8a // alternate setting
17#define I2C_ADDR_TDA8425 0x82 15#define I2C_ADDR_TDA8425 0x82
18#define I2C_ADDR_TDA9840 0x84 16#define I2C_ADDR_TDA9840 0x84
19#define I2C_ADDR_TDA9850 0xb6 /* also used by 9855,9873 */ 17#define I2C_ADDR_TDA9850 0xb6 /* also used by 9855,9873 */
diff --git a/include/media/ir-common.h b/include/media/ir-common.h
index 38f2d93c395..5bf2ea00678 100644
--- a/include/media/ir-common.h
+++ b/include/media/ir-common.h
@@ -157,6 +157,8 @@ extern IR_KEYTAB_TYPE ir_codes_avermedia_a16d[IR_KEYTAB_SIZE];
157extern IR_KEYTAB_TYPE ir_codes_encore_enltv_fm53[IR_KEYTAB_SIZE]; 157extern IR_KEYTAB_TYPE ir_codes_encore_enltv_fm53[IR_KEYTAB_SIZE];
158extern IR_KEYTAB_TYPE ir_codes_real_audio_220_32_keys[IR_KEYTAB_SIZE]; 158extern IR_KEYTAB_TYPE ir_codes_real_audio_220_32_keys[IR_KEYTAB_SIZE];
159extern IR_KEYTAB_TYPE ir_codes_msi_tvanywhere_plus[IR_KEYTAB_SIZE]; 159extern IR_KEYTAB_TYPE ir_codes_msi_tvanywhere_plus[IR_KEYTAB_SIZE];
160extern IR_KEYTAB_TYPE ir_codes_ati_tv_wonder_hd_600[IR_KEYTAB_SIZE];
161extern IR_KEYTAB_TYPE ir_codes_kworld_plus_tv_analog[IR_KEYTAB_SIZE];
160#endif 162#endif
161 163
162/* 164/*
diff --git a/include/media/ov772x.h b/include/media/ov772x.h
new file mode 100644
index 00000000000..e391d55edb9
--- /dev/null
+++ b/include/media/ov772x.h
@@ -0,0 +1,21 @@
1/* ov772x Camera
2 *
3 * Copyright (C) 2008 Renesas Solutions Corp.
4 * Kuninori Morimoto <morimoto.kuninori@renesas.com>
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#ifndef __OV772X_H__
12#define __OV772X_H__
13
14#include <media/soc_camera.h>
15
16struct ov772x_camera_info {
17 unsigned long buswidth;
18 struct soc_camera_link link;
19};
20
21#endif /* __OV772X_H__ */
diff --git a/include/media/saa7146_vv.h b/include/media/saa7146_vv.h
index 1d104096619..6bbb0d93bb5 100644
--- a/include/media/saa7146_vv.h
+++ b/include/media/saa7146_vv.h
@@ -216,8 +216,7 @@ void saa7146_set_gpio(struct saa7146_dev *saa, u8 pin, u8 data);
216extern struct saa7146_use_ops saa7146_video_uops; 216extern struct saa7146_use_ops saa7146_video_uops;
217int saa7146_start_preview(struct saa7146_fh *fh); 217int saa7146_start_preview(struct saa7146_fh *fh);
218int saa7146_stop_preview(struct saa7146_fh *fh); 218int saa7146_stop_preview(struct saa7146_fh *fh);
219int saa7146_video_do_ioctl(struct inode *inode, struct file *file, 219int saa7146_video_do_ioctl(struct file *file, unsigned int cmd, void *arg);
220 unsigned int cmd, void *arg);
221 220
222/* from saa7146_vbi.c */ 221/* from saa7146_vbi.c */
223extern struct saa7146_use_ops saa7146_vbi_uops; 222extern struct saa7146_use_ops saa7146_vbi_uops;
diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h
index c5de7bb19fd..425b6a98c95 100644
--- a/include/media/soc_camera.h
+++ b/include/media/soc_camera.h
@@ -12,9 +12,10 @@
12#ifndef SOC_CAMERA_H 12#ifndef SOC_CAMERA_H
13#define SOC_CAMERA_H 13#define SOC_CAMERA_H
14 14
15#include <linux/mutex.h>
16#include <linux/pm.h>
15#include <linux/videodev2.h> 17#include <linux/videodev2.h>
16#include <media/videobuf-core.h> 18#include <media/videobuf-core.h>
17#include <linux/pm.h>
18 19
19struct soc_camera_device { 20struct soc_camera_device {
20 struct list_head list; 21 struct list_head list;
@@ -36,14 +37,19 @@ struct soc_camera_device {
36 unsigned char iface; /* Host number */ 37 unsigned char iface; /* Host number */
37 unsigned char devnum; /* Device number per host */ 38 unsigned char devnum; /* Device number per host */
38 unsigned char buswidth; /* See comment in .c */ 39 unsigned char buswidth; /* See comment in .c */
40 struct soc_camera_sense *sense; /* See comment in struct definition */
39 struct soc_camera_ops *ops; 41 struct soc_camera_ops *ops;
40 struct video_device *vdev; 42 struct video_device *vdev;
41 const struct soc_camera_data_format *current_fmt; 43 const struct soc_camera_data_format *current_fmt;
42 const struct soc_camera_data_format *formats; 44 const struct soc_camera_data_format *formats;
43 int num_formats; 45 int num_formats;
46 struct soc_camera_format_xlate *user_formats;
47 int num_user_formats;
44 struct module *owner; 48 struct module *owner;
45 /* soc_camera.c private count. Only accessed with video_lock held */ 49 void *host_priv; /* Per-device host private data */
50 /* soc_camera.c private count. Only accessed with .video_lock held */
46 int use_count; 51 int use_count;
52 struct mutex video_lock; /* Protects device data */
47}; 53};
48 54
49struct soc_camera_file { 55struct soc_camera_file {
@@ -56,7 +62,7 @@ struct soc_camera_host {
56 struct device dev; 62 struct device dev;
57 unsigned char nr; /* Host number */ 63 unsigned char nr; /* Host number */
58 void *priv; 64 void *priv;
59 char *drv_name; 65 const char *drv_name;
60 struct soc_camera_host_ops *ops; 66 struct soc_camera_host_ops *ops;
61}; 67};
62 68
@@ -64,25 +70,33 @@ struct soc_camera_host_ops {
64 struct module *owner; 70 struct module *owner;
65 int (*add)(struct soc_camera_device *); 71 int (*add)(struct soc_camera_device *);
66 void (*remove)(struct soc_camera_device *); 72 void (*remove)(struct soc_camera_device *);
67 int (*suspend)(struct soc_camera_device *, pm_message_t state); 73 int (*suspend)(struct soc_camera_device *, pm_message_t);
68 int (*resume)(struct soc_camera_device *); 74 int (*resume)(struct soc_camera_device *);
69 int (*set_fmt_cap)(struct soc_camera_device *, __u32, 75 int (*get_formats)(struct soc_camera_device *, int,
70 struct v4l2_rect *); 76 struct soc_camera_format_xlate *);
71 int (*try_fmt_cap)(struct soc_camera_device *, struct v4l2_format *); 77 int (*set_fmt)(struct soc_camera_device *, __u32, struct v4l2_rect *);
78 int (*try_fmt)(struct soc_camera_device *, struct v4l2_format *);
72 void (*init_videobuf)(struct videobuf_queue *, 79 void (*init_videobuf)(struct videobuf_queue *,
73 struct soc_camera_device *); 80 struct soc_camera_device *);
74 int (*reqbufs)(struct soc_camera_file *, struct v4l2_requestbuffers *); 81 int (*reqbufs)(struct soc_camera_file *, struct v4l2_requestbuffers *);
75 int (*querycap)(struct soc_camera_host *, struct v4l2_capability *); 82 int (*querycap)(struct soc_camera_host *, struct v4l2_capability *);
76 int (*try_bus_param)(struct soc_camera_device *, __u32);
77 int (*set_bus_param)(struct soc_camera_device *, __u32); 83 int (*set_bus_param)(struct soc_camera_device *, __u32);
78 unsigned int (*poll)(struct file *, poll_table *); 84 unsigned int (*poll)(struct file *, poll_table *);
79}; 85};
80 86
87#define SOCAM_SENSOR_INVERT_PCLK (1 << 0)
88#define SOCAM_SENSOR_INVERT_MCLK (1 << 1)
89#define SOCAM_SENSOR_INVERT_HSYNC (1 << 2)
90#define SOCAM_SENSOR_INVERT_VSYNC (1 << 3)
91#define SOCAM_SENSOR_INVERT_DATA (1 << 4)
92
81struct soc_camera_link { 93struct soc_camera_link {
82 /* Camera bus id, used to match a camera and a bus */ 94 /* Camera bus id, used to match a camera and a bus */
83 int bus_id; 95 int bus_id;
84 /* GPIO number to switch between 8 and 10 bit modes */ 96 /* GPIO number to switch between 8 and 10 bit modes */
85 unsigned int gpio; 97 unsigned int gpio;
98 /* Per camera SOCAM_SENSOR_* bus flags */
99 unsigned long flags;
86 /* Optional callbacks to power on or off and reset the sensor */ 100 /* Optional callbacks to power on or off and reset the sensor */
87 int (*power)(struct device *, int); 101 int (*power)(struct device *, int);
88 int (*reset)(struct device *); 102 int (*reset)(struct device *);
@@ -106,13 +120,35 @@ extern void soc_camera_device_unregister(struct soc_camera_device *icd);
106extern int soc_camera_video_start(struct soc_camera_device *icd); 120extern int soc_camera_video_start(struct soc_camera_device *icd);
107extern void soc_camera_video_stop(struct soc_camera_device *icd); 121extern void soc_camera_video_stop(struct soc_camera_device *icd);
108 122
123extern const struct soc_camera_data_format *soc_camera_format_by_fourcc(
124 struct soc_camera_device *icd, unsigned int fourcc);
125extern const struct soc_camera_format_xlate *soc_camera_xlate_by_fourcc(
126 struct soc_camera_device *icd, unsigned int fourcc);
127
109struct soc_camera_data_format { 128struct soc_camera_data_format {
110 char *name; 129 const char *name;
111 unsigned int depth; 130 unsigned int depth;
112 __u32 fourcc; 131 __u32 fourcc;
113 enum v4l2_colorspace colorspace; 132 enum v4l2_colorspace colorspace;
114}; 133};
115 134
135/**
136 * struct soc_camera_format_xlate - match between host and sensor formats
137 * @cam_fmt: sensor format provided by the sensor
138 * @host_fmt: host format after host translation from cam_fmt
139 * @buswidth: bus width for this format
140 *
141 * Host and sensor translation structure. Used in table of host and sensor
142 * formats matchings in soc_camera_device. A host can override the generic list
143 * generation by implementing get_formats(), and use it for format checks and
144 * format setup.
145 */
146struct soc_camera_format_xlate {
147 const struct soc_camera_data_format *cam_fmt;
148 const struct soc_camera_data_format *host_fmt;
149 unsigned char buswidth;
150};
151
116struct soc_camera_ops { 152struct soc_camera_ops {
117 struct module *owner; 153 struct module *owner;
118 int (*probe)(struct soc_camera_device *); 154 int (*probe)(struct soc_camera_device *);
@@ -123,13 +159,14 @@ struct soc_camera_ops {
123 int (*release)(struct soc_camera_device *); 159 int (*release)(struct soc_camera_device *);
124 int (*start_capture)(struct soc_camera_device *); 160 int (*start_capture)(struct soc_camera_device *);
125 int (*stop_capture)(struct soc_camera_device *); 161 int (*stop_capture)(struct soc_camera_device *);
126 int (*set_fmt_cap)(struct soc_camera_device *, __u32, 162 int (*set_fmt)(struct soc_camera_device *, __u32, struct v4l2_rect *);
127 struct v4l2_rect *); 163 int (*try_fmt)(struct soc_camera_device *, struct v4l2_format *);
128 int (*try_fmt_cap)(struct soc_camera_device *, struct v4l2_format *);
129 unsigned long (*query_bus_param)(struct soc_camera_device *); 164 unsigned long (*query_bus_param)(struct soc_camera_device *);
130 int (*set_bus_param)(struct soc_camera_device *, unsigned long); 165 int (*set_bus_param)(struct soc_camera_device *, unsigned long);
131 int (*get_chip_id)(struct soc_camera_device *, 166 int (*get_chip_id)(struct soc_camera_device *,
132 struct v4l2_chip_ident *); 167 struct v4l2_chip_ident *);
168 int (*set_std)(struct soc_camera_device *, v4l2_std_id *);
169 int (*enum_input)(struct soc_camera_device *, struct v4l2_input *);
133#ifdef CONFIG_VIDEO_ADV_DEBUG 170#ifdef CONFIG_VIDEO_ADV_DEBUG
134 int (*get_register)(struct soc_camera_device *, struct v4l2_register *); 171 int (*get_register)(struct soc_camera_device *, struct v4l2_register *);
135 int (*set_register)(struct soc_camera_device *, struct v4l2_register *); 172 int (*set_register)(struct soc_camera_device *, struct v4l2_register *);
@@ -140,6 +177,32 @@ struct soc_camera_ops {
140 int num_controls; 177 int num_controls;
141}; 178};
142 179
180#define SOCAM_SENSE_PCLK_CHANGED (1 << 0)
181
182/**
183 * This struct can be attached to struct soc_camera_device by the host driver
184 * to request sense from the camera, for example, when calling .set_fmt(). The
185 * host then can check which flags are set and verify respective values if any.
186 * For example, if SOCAM_SENSE_PCLK_CHANGED is set, it means, pixclock has
187 * changed during this operation. After completion the host should detach sense.
188 *
189 * @flags ored SOCAM_SENSE_* flags
190 * @master_clock if the host wants to be informed about pixel-clock
191 * change, it better set master_clock.
192 * @pixel_clock_max maximum pixel clock frequency supported by the host,
193 * camera is not allowed to exceed this.
194 * @pixel_clock if the camera driver changed pixel clock during this
195 * operation, it sets SOCAM_SENSE_PCLK_CHANGED, uses
196 * master_clock to calculate the new pixel-clock and
197 * sets this field.
198 */
199struct soc_camera_sense {
200 unsigned long flags;
201 unsigned long master_clock;
202 unsigned long pixel_clock_max;
203 unsigned long pixel_clock;
204};
205
143static inline struct v4l2_queryctrl const *soc_camera_find_qctrl( 206static inline struct v4l2_queryctrl const *soc_camera_find_qctrl(
144 struct soc_camera_ops *ops, int id) 207 struct soc_camera_ops *ops, int id)
145{ 208{
@@ -158,15 +221,20 @@ static inline struct v4l2_queryctrl const *soc_camera_find_qctrl(
158#define SOCAM_HSYNC_ACTIVE_LOW (1 << 3) 221#define SOCAM_HSYNC_ACTIVE_LOW (1 << 3)
159#define SOCAM_VSYNC_ACTIVE_HIGH (1 << 4) 222#define SOCAM_VSYNC_ACTIVE_HIGH (1 << 4)
160#define SOCAM_VSYNC_ACTIVE_LOW (1 << 5) 223#define SOCAM_VSYNC_ACTIVE_LOW (1 << 5)
161#define SOCAM_DATAWIDTH_8 (1 << 6) 224#define SOCAM_DATAWIDTH_4 (1 << 6)
162#define SOCAM_DATAWIDTH_9 (1 << 7) 225#define SOCAM_DATAWIDTH_8 (1 << 7)
163#define SOCAM_DATAWIDTH_10 (1 << 8) 226#define SOCAM_DATAWIDTH_9 (1 << 8)
164#define SOCAM_DATAWIDTH_16 (1 << 9) 227#define SOCAM_DATAWIDTH_10 (1 << 9)
165#define SOCAM_PCLK_SAMPLE_RISING (1 << 10) 228#define SOCAM_DATAWIDTH_15 (1 << 10)
166#define SOCAM_PCLK_SAMPLE_FALLING (1 << 11) 229#define SOCAM_DATAWIDTH_16 (1 << 11)
230#define SOCAM_PCLK_SAMPLE_RISING (1 << 12)
231#define SOCAM_PCLK_SAMPLE_FALLING (1 << 13)
232#define SOCAM_DATA_ACTIVE_HIGH (1 << 14)
233#define SOCAM_DATA_ACTIVE_LOW (1 << 15)
167 234
168#define SOCAM_DATAWIDTH_MASK (SOCAM_DATAWIDTH_8 | SOCAM_DATAWIDTH_9 | \ 235#define SOCAM_DATAWIDTH_MASK (SOCAM_DATAWIDTH_4 | SOCAM_DATAWIDTH_8 | \
169 SOCAM_DATAWIDTH_10 | SOCAM_DATAWIDTH_16) 236 SOCAM_DATAWIDTH_9 | SOCAM_DATAWIDTH_10 | \
237 SOCAM_DATAWIDTH_15 | SOCAM_DATAWIDTH_16)
170 238
171static inline unsigned long soc_camera_bus_param_compatible( 239static inline unsigned long soc_camera_bus_param_compatible(
172 unsigned long camera_flags, unsigned long bus_flags) 240 unsigned long camera_flags, unsigned long bus_flags)
@@ -182,4 +250,7 @@ static inline unsigned long soc_camera_bus_param_compatible(
182 return (!hsync || !vsync || !pclk) ? 0 : common_flags; 250 return (!hsync || !vsync || !pclk) ? 0 : common_flags;
183} 251}
184 252
253extern unsigned long soc_camera_apply_sensor_flags(struct soc_camera_link *icl,
254 unsigned long flags);
255
185#endif 256#endif
diff --git a/include/media/tvp514x.h b/include/media/tvp514x.h
new file mode 100644
index 00000000000..5e7ee968c6d
--- /dev/null
+++ b/include/media/tvp514x.h
@@ -0,0 +1,118 @@
1/*
2 * drivers/media/video/tvp514x.h
3 *
4 * Copyright (C) 2008 Texas Instruments Inc
5 * Author: Vaibhav Hiremath <hvaibhav@ti.com>
6 *
7 * Contributors:
8 * Sivaraj R <sivaraj@ti.com>
9 * Brijesh R Jadav <brijesh.j@ti.com>
10 * Hardik Shah <hardik.shah@ti.com>
11 * Manjunath Hadli <mrh@ti.com>
12 * Karicheri Muralidharan <m-karicheri2@ti.com>
13 *
14 * This package is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License version 2 as
16 * published by the Free Software Foundation.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 *
27 */
28
29#ifndef _TVP514X_H
30#define _TVP514X_H
31
32/*
33 * Other macros
34 */
35#define TVP514X_MODULE_NAME "tvp514x"
36
37#define TVP514X_XCLK_BT656 (27000000)
38
39/* Number of pixels and number of lines per frame for different standards */
40#define NTSC_NUM_ACTIVE_PIXELS (720)
41#define NTSC_NUM_ACTIVE_LINES (480)
42#define PAL_NUM_ACTIVE_PIXELS (720)
43#define PAL_NUM_ACTIVE_LINES (576)
44
45/**
46 * enum tvp514x_input - enum for different decoder input pin
47 * configuration.
48 */
49enum tvp514x_input {
50 /*
51 * CVBS input selection
52 */
53 INPUT_CVBS_VI1A = 0x0,
54 INPUT_CVBS_VI1B,
55 INPUT_CVBS_VI1C,
56 INPUT_CVBS_VI2A = 0x04,
57 INPUT_CVBS_VI2B,
58 INPUT_CVBS_VI2C,
59 INPUT_CVBS_VI3A = 0x08,
60 INPUT_CVBS_VI3B,
61 INPUT_CVBS_VI3C,
62 INPUT_CVBS_VI4A = 0x0C,
63 /*
64 * S-Video input selection
65 */
66 INPUT_SVIDEO_VI2A_VI1A = 0x44,
67 INPUT_SVIDEO_VI2B_VI1B,
68 INPUT_SVIDEO_VI2C_VI1C,
69 INPUT_SVIDEO_VI2A_VI3A = 0x54,
70 INPUT_SVIDEO_VI2B_VI3B,
71 INPUT_SVIDEO_VI2C_VI3C,
72 INPUT_SVIDEO_VI4A_VI1A = 0x4C,
73 INPUT_SVIDEO_VI4A_VI1B,
74 INPUT_SVIDEO_VI4A_VI1C,
75 INPUT_SVIDEO_VI4A_VI3A = 0x5C,
76 INPUT_SVIDEO_VI4A_VI3B,
77 INPUT_SVIDEO_VI4A_VI3C,
78
79 /* Need to add entries for
80 * RGB, YPbPr and SCART.
81 */
82 INPUT_INVALID
83};
84
85/**
86 * enum tvp514x_output - enum for output format
87 * supported.
88 *
89 */
90enum tvp514x_output {
91 OUTPUT_10BIT_422_EMBEDDED_SYNC = 0,
92 OUTPUT_20BIT_422_SEPERATE_SYNC,
93 OUTPUT_10BIT_422_SEPERATE_SYNC = 3,
94 OUTPUT_INVALID
95};
96
97/**
98 * struct tvp514x_platform_data - Platform data values and access functions.
99 * @power_set: Power state access function, zero is off, non-zero is on.
100 * @ifparm: Interface parameters access function.
101 * @priv_data_set: Device private data (pointer) access function.
102 * @clk_polarity: Clock polarity of the current interface.
103 * @ hs_polarity: HSYNC Polarity configuration for current interface.
104 * @ vs_polarity: VSYNC Polarity configuration for current interface.
105 */
106struct tvp514x_platform_data {
107 char *master;
108 int (*power_set) (enum v4l2_power on);
109 int (*ifparm) (struct v4l2_ifparm *p);
110 int (*priv_data_set) (void *);
111 /* Interface control params */
112 bool clk_polarity;
113 bool hs_polarity;
114 bool vs_polarity;
115};
116
117
118#endif /* ifndef _TVP514X_H */
diff --git a/include/media/tw9910.h b/include/media/tw9910.h
new file mode 100644
index 00000000000..73231e7880d
--- /dev/null
+++ b/include/media/tw9910.h
@@ -0,0 +1,39 @@
1/*
2 * tw9910 Driver header
3 *
4 * Copyright (C) 2008 Renesas Solutions Corp.
5 * Kuninori Morimoto <morimoto.kuninori@renesas.com>
6 *
7 * Based on ov772x.h
8 *
9 * Copyright (C) Kuninori Morimoto <morimoto.kuninori@renesas.com>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14 */
15
16#ifndef __TW9910_H__
17#define __TW9910_H__
18
19#include <media/soc_camera.h>
20
21enum tw9910_mpout_pin {
22 TW9910_MPO_VLOSS,
23 TW9910_MPO_HLOCK,
24 TW9910_MPO_SLOCK,
25 TW9910_MPO_VLOCK,
26 TW9910_MPO_MONO,
27 TW9910_MPO_DET50,
28 TW9910_MPO_FIELD,
29 TW9910_MPO_RTCO,
30};
31
32struct tw9910_video_info {
33 unsigned long buswidth;
34 enum tw9910_mpout_pin mpout;
35 struct soc_camera_link link;
36};
37
38
39#endif /* __TW9910_H__ */
diff --git a/include/media/v4l2-chip-ident.h b/include/media/v4l2-chip-ident.h
index d73a8e9028a..43dbb659f1f 100644
--- a/include/media/v4l2-chip-ident.h
+++ b/include/media/v4l2-chip-ident.h
@@ -60,6 +60,8 @@ enum {
60 60
61 /* OmniVision sensors: reserved range 250-299 */ 61 /* OmniVision sensors: reserved range 250-299 */
62 V4L2_IDENT_OV7670 = 250, 62 V4L2_IDENT_OV7670 = 250,
63 V4L2_IDENT_OV7720 = 251,
64 V4L2_IDENT_OV7725 = 252,
63 65
64 /* Conexant MPEG encoder/decoders: reserved range 410-420 */ 66 /* Conexant MPEG encoder/decoders: reserved range 410-420 */
65 V4L2_IDENT_CX23415 = 415, 67 V4L2_IDENT_CX23415 = 415,
@@ -69,6 +71,9 @@ enum {
69 /* module vp27smpx: just ident 2700 */ 71 /* module vp27smpx: just ident 2700 */
70 V4L2_IDENT_VP27SMPX = 2700, 72 V4L2_IDENT_VP27SMPX = 2700,
71 73
74 /* module tvp5150 */
75 V4L2_IDENT_TVP5150 = 5150,
76
72 /* module cs5345: just ident 5345 */ 77 /* module cs5345: just ident 5345 */
73 V4L2_IDENT_CS5345 = 5345, 78 V4L2_IDENT_CS5345 = 5345,
74 79
@@ -82,6 +87,9 @@ enum {
82 /* module wm8775: just ident 8775 */ 87 /* module wm8775: just ident 8775 */
83 V4L2_IDENT_WM8775 = 8775, 88 V4L2_IDENT_WM8775 = 8775,
84 89
90 /* module tw9910: just ident 9910 */
91 V4L2_IDENT_TW9910 = 9910,
92
85 /* module cs53132a: just ident 53132 */ 93 /* module cs53132a: just ident 53132 */
86 V4L2_IDENT_CS53l32A = 53132, 94 V4L2_IDENT_CS53l32A = 53132,
87 95
@@ -166,8 +174,10 @@ enum {
166 V4L2_IDENT_MT9M001C12ST = 45000, 174 V4L2_IDENT_MT9M001C12ST = 45000,
167 V4L2_IDENT_MT9M001C12STM = 45005, 175 V4L2_IDENT_MT9M001C12STM = 45005,
168 V4L2_IDENT_MT9M111 = 45007, 176 V4L2_IDENT_MT9M111 = 45007,
177 V4L2_IDENT_MT9M112 = 45008,
169 V4L2_IDENT_MT9V022IX7ATC = 45010, /* No way to detect "normal" I77ATx */ 178 V4L2_IDENT_MT9V022IX7ATC = 45010, /* No way to detect "normal" I77ATx */
170 V4L2_IDENT_MT9V022IX7ATM = 45015, /* and "lead free" IA7ATx chips */ 179 V4L2_IDENT_MT9V022IX7ATM = 45015, /* and "lead free" IA7ATx chips */
180 V4L2_IDENT_MT9T031 = 45020,
171}; 181};
172 182
173#endif 183#endif
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
index 2f8719abf5c..f99c866d8c3 100644
--- a/include/media/v4l2-common.h
+++ b/include/media/v4l2-common.h
@@ -57,6 +57,29 @@
57 57
58/* ------------------------------------------------------------------------- */ 58/* ------------------------------------------------------------------------- */
59 59
60/* These printk constructs can be used with v4l2_device and v4l2_subdev */
61#define v4l2_printk(level, dev, fmt, arg...) \
62 printk(level "%s: " fmt, (dev)->name , ## arg)
63
64#define v4l2_err(dev, fmt, arg...) \
65 v4l2_printk(KERN_ERR, dev, fmt , ## arg)
66
67#define v4l2_warn(dev, fmt, arg...) \
68 v4l2_printk(KERN_WARNING, dev, fmt , ## arg)
69
70#define v4l2_info(dev, fmt, arg...) \
71 v4l2_printk(KERN_INFO, dev, fmt , ## arg)
72
73/* These three macros assume that the debug level is set with a module
74 parameter called 'debug'. */
75#define v4l2_dbg(level, debug, dev, fmt, arg...) \
76 do { \
77 if (debug >= (level)) \
78 v4l2_printk(KERN_DEBUG, dev, fmt , ## arg); \
79 } while (0)
80
81/* ------------------------------------------------------------------------- */
82
60/* Priority helper functions */ 83/* Priority helper functions */
61 84
62struct v4l2_prio_state { 85struct v4l2_prio_state {
@@ -104,11 +127,29 @@ struct i2c_driver;
104struct i2c_adapter; 127struct i2c_adapter;
105struct i2c_client; 128struct i2c_client;
106struct i2c_device_id; 129struct i2c_device_id;
130struct v4l2_device;
131struct v4l2_subdev;
132struct v4l2_subdev_ops;
107 133
108int v4l2_i2c_attach(struct i2c_adapter *adapter, int address, struct i2c_driver *driver, 134int v4l2_i2c_attach(struct i2c_adapter *adapter, int address, struct i2c_driver *driver,
109 const char *name, 135 const char *name,
110 int (*probe)(struct i2c_client *, const struct i2c_device_id *)); 136 int (*probe)(struct i2c_client *, const struct i2c_device_id *));
111 137
138/* Load an i2c module and return an initialized v4l2_subdev struct.
139 Only call request_module if module_name != NULL.
140 The client_type argument is the name of the chip that's on the adapter. */
141struct v4l2_subdev *v4l2_i2c_new_subdev(struct i2c_adapter *adapter,
142 const char *module_name, const char *client_type, u8 addr);
143/* Probe and load an i2c module and return an initialized v4l2_subdev struct.
144 Only call request_module if module_name != NULL.
145 The client_type argument is the name of the chip that's on the adapter. */
146struct v4l2_subdev *v4l2_i2c_new_probed_subdev(struct i2c_adapter *adapter,
147 const char *module_name, const char *client_type,
148 const unsigned short *addrs);
149/* Initialize an v4l2_subdev with data from an i2c_client struct */
150void v4l2_i2c_subdev_init(struct v4l2_subdev *sd, struct i2c_client *client,
151 const struct v4l2_subdev_ops *ops);
152
112/* ------------------------------------------------------------------------- */ 153/* ------------------------------------------------------------------------- */
113 154
114/* Internal ioctls */ 155/* Internal ioctls */
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
index a0a6b41c5e0..0a88d1d17d3 100644
--- a/include/media/v4l2-dev.h
+++ b/include/media/v4l2-dev.h
@@ -25,6 +25,12 @@
25#define VFL_TYPE_MAX 4 25#define VFL_TYPE_MAX 4
26 26
27struct v4l2_ioctl_callbacks; 27struct v4l2_ioctl_callbacks;
28struct v4l2_device;
29
30/* Flag to mark the video_device struct as unregistered.
31 Drivers can set this flag if they want to block all future
32 device access. It is set by video_unregister_device. */
33#define V4L2_FL_UNREGISTERED (0)
28 34
29/* 35/*
30 * Newer version of video_device, handled by videodev2.c 36 * Newer version of video_device, handled by videodev2.c
@@ -39,15 +45,20 @@ struct video_device
39 45
40 /* sysfs */ 46 /* sysfs */
41 struct device dev; /* v4l device */ 47 struct device dev; /* v4l device */
42 struct cdev cdev; /* character device */ 48 struct cdev *cdev; /* character device */
43 void (*cdev_release)(struct kobject *kobj); 49
50 /* Set either parent or v4l2_dev if your driver uses v4l2_device */
44 struct device *parent; /* device parent */ 51 struct device *parent; /* device parent */
52 struct v4l2_device *v4l2_dev; /* v4l2_device parent */
45 53
46 /* device info */ 54 /* device info */
47 char name[32]; 55 char name[32];
48 int vfl_type; 56 int vfl_type;
57 /* 'minor' is set to -1 if the registration failed */
49 int minor; 58 int minor;
50 u16 num; 59 u16 num;
60 /* use bitops to set/clear/test flags */
61 unsigned long flags;
51 /* attribute to differentiate multiple indices on one physical device */ 62 /* attribute to differentiate multiple indices on one physical device */
52 int index; 63 int index;
53 64
@@ -58,7 +69,7 @@ struct video_device
58 v4l2_std_id current_norm; /* Current tvnorm */ 69 v4l2_std_id current_norm; /* Current tvnorm */
59 70
60 /* callbacks */ 71 /* callbacks */
61 void (*release)(struct video_device *vfd); 72 void (*release)(struct video_device *vdev);
62 73
63 /* ioctl callbacks */ 74 /* ioctl callbacks */
64 const struct v4l2_ioctl_ops *ioctl_ops; 75 const struct v4l2_ioctl_ops *ioctl_ops;
@@ -67,36 +78,41 @@ struct video_device
67/* dev to video-device */ 78/* dev to video-device */
68#define to_video_device(cd) container_of(cd, struct video_device, dev) 79#define to_video_device(cd) container_of(cd, struct video_device, dev)
69 80
70/* Register and unregister devices. Note that if video_register_device fails, 81/* Register video devices. Note that if video_register_device fails,
71 the release() callback of the video_device structure is *not* called, so 82 the release() callback of the video_device structure is *not* called, so
72 the caller is responsible for freeing any data. Usually that means that 83 the caller is responsible for freeing any data. Usually that means that
73 you call video_device_release() on failure. */ 84 you call video_device_release() on failure.
74int __must_check video_register_device(struct video_device *vfd, int type, int nr); 85
75int __must_check video_register_device_index(struct video_device *vfd, 86 Also note that vdev->minor is set to -1 if the registration failed. */
87int __must_check video_register_device(struct video_device *vdev, int type, int nr);
88int __must_check video_register_device_index(struct video_device *vdev,
76 int type, int nr, int index); 89 int type, int nr, int index);
77void video_unregister_device(struct video_device *vfd); 90
91/* Unregister video devices. Will do nothing if vdev == NULL or
92 vdev->minor < 0. */
93void video_unregister_device(struct video_device *vdev);
78 94
79/* helper functions to alloc/release struct video_device, the 95/* helper functions to alloc/release struct video_device, the
80 latter can also be used for video_device->release(). */ 96 latter can also be used for video_device->release(). */
81struct video_device * __must_check video_device_alloc(void); 97struct video_device * __must_check video_device_alloc(void);
82 98
83/* this release function frees the vfd pointer */ 99/* this release function frees the vdev pointer */
84void video_device_release(struct video_device *vfd); 100void video_device_release(struct video_device *vdev);
85 101
86/* this release function does nothing, use when the video_device is a 102/* this release function does nothing, use when the video_device is a
87 static global struct. Note that having a static video_device is 103 static global struct. Note that having a static video_device is
88 a dubious construction at best. */ 104 a dubious construction at best. */
89void video_device_release_empty(struct video_device *vfd); 105void video_device_release_empty(struct video_device *vdev);
90 106
91/* helper functions to access driver private data. */ 107/* helper functions to access driver private data. */
92static inline void *video_get_drvdata(struct video_device *dev) 108static inline void *video_get_drvdata(struct video_device *vdev)
93{ 109{
94 return dev_get_drvdata(&dev->dev); 110 return dev_get_drvdata(&vdev->dev);
95} 111}
96 112
97static inline void video_set_drvdata(struct video_device *dev, void *data) 113static inline void video_set_drvdata(struct video_device *vdev, void *data)
98{ 114{
99 dev_set_drvdata(&dev->dev, data); 115 dev_set_drvdata(&vdev->dev, data);
100} 116}
101 117
102struct video_device *video_devdata(struct file *file); 118struct video_device *video_devdata(struct file *file);
@@ -108,4 +124,9 @@ static inline void *video_drvdata(struct file *file)
108 return video_get_drvdata(video_devdata(file)); 124 return video_get_drvdata(video_devdata(file));
109} 125}
110 126
127static inline int video_is_unregistered(struct video_device *vdev)
128{
129 return test_bit(V4L2_FL_UNREGISTERED, &vdev->flags);
130}
131
111#endif /* _V4L2_DEV_H */ 132#endif /* _V4L2_DEV_H */
diff --git a/include/media/v4l2-device.h b/include/media/v4l2-device.h
new file mode 100644
index 00000000000..97b283a0428
--- /dev/null
+++ b/include/media/v4l2-device.h
@@ -0,0 +1,109 @@
1/*
2 V4L2 device support header.
3
4 Copyright (C) 2008 Hans Verkuil <hverkuil@xs4all.nl>
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#ifndef _V4L2_DEVICE_H
22#define _V4L2_DEVICE_H
23
24#include <media/v4l2-subdev.h>
25
26/* Each instance of a V4L2 device should create the v4l2_device struct,
27 either stand-alone or embedded in a larger struct.
28
29 It allows easy access to sub-devices (see v4l2-subdev.h) and provides
30 basic V4L2 device-level support.
31 */
32
33#define V4L2_DEVICE_NAME_SIZE (BUS_ID_SIZE + 16)
34
35struct v4l2_device {
36 /* dev->driver_data points to this struct */
37 struct device *dev;
38 /* used to keep track of the registered subdevs */
39 struct list_head subdevs;
40 /* lock this struct; can be used by the driver as well if this
41 struct is embedded into a larger struct. */
42 spinlock_t lock;
43 /* unique device name, by default the driver name + bus ID */
44 char name[V4L2_DEVICE_NAME_SIZE];
45};
46
47/* Initialize v4l2_dev and make dev->driver_data point to v4l2_dev */
48int __must_check v4l2_device_register(struct device *dev, struct v4l2_device *v4l2_dev);
49/* Set v4l2_dev->dev->driver_data to NULL and unregister all sub-devices */
50void v4l2_device_unregister(struct v4l2_device *v4l2_dev);
51
52/* Register a subdev with a v4l2 device. While registered the subdev module
53 is marked as in-use. An error is returned if the module is no longer
54 loaded when you attempt to register it. */
55int __must_check v4l2_device_register_subdev(struct v4l2_device *dev, struct v4l2_subdev *sd);
56/* Unregister a subdev with a v4l2 device. Can also be called if the subdev
57 wasn't registered. In that case it will do nothing. */
58void v4l2_device_unregister_subdev(struct v4l2_subdev *sd);
59
60/* Iterate over all subdevs. */
61#define v4l2_device_for_each_subdev(sd, dev) \
62 list_for_each_entry(sd, &(dev)->subdevs, list)
63
64/* Call the specified callback for all subdevs matching the condition.
65 Ignore any errors. Note that you cannot add or delete a subdev
66 while walking the subdevs list. */
67#define __v4l2_device_call_subdevs(dev, cond, o, f, args...) \
68 do { \
69 struct v4l2_subdev *sd; \
70 \
71 list_for_each_entry(sd, &(dev)->subdevs, list) \
72 if ((cond) && sd->ops->o && sd->ops->o->f) \
73 sd->ops->o->f(sd , ##args); \
74 } while (0)
75
76/* Call the specified callback for all subdevs matching the condition.
77 If the callback returns an error other than 0 or -ENOIOCTLCMD, then
78 return with that error code. Note that you cannot add or delete a
79 subdev while walking the subdevs list. */
80#define __v4l2_device_call_subdevs_until_err(dev, cond, o, f, args...) \
81({ \
82 struct v4l2_subdev *sd; \
83 int err = 0; \
84 \
85 list_for_each_entry(sd, &(dev)->subdevs, list) { \
86 if ((cond) && sd->ops->o && sd->ops->o->f) \
87 err = sd->ops->o->f(sd , ##args); \
88 if (err && err != -ENOIOCTLCMD) \
89 break; \
90 } \
91 (err == -ENOIOCTLCMD) ? 0 : err; \
92})
93
94/* Call the specified callback for all subdevs matching grp_id (if 0, then
95 match them all). Ignore any errors. Note that you cannot add or delete
96 a subdev while walking the subdevs list. */
97#define v4l2_device_call_all(dev, grp_id, o, f, args...) \
98 __v4l2_device_call_subdevs(dev, \
99 !(grp_id) || sd->grp_id == (grp_id), o, f , ##args)
100
101/* Call the specified callback for all subdevs matching grp_id (if 0, then
102 match them all). If the callback returns an error other than 0 or
103 -ENOIOCTLCMD, then return with that error code. Note that you cannot
104 add or delete a subdev while walking the subdevs list. */
105#define v4l2_device_call_until_err(dev, grp_id, o, f, args...) \
106 __v4l2_device_call_subdevs_until_err(dev, \
107 !(grp_id) || sd->grp_id == (grp_id), o, f , ##args)
108
109#endif
diff --git a/include/media/v4l2-int-device.h b/include/media/v4l2-int-device.h
index 9c2df41dbf9..ecda3c72583 100644
--- a/include/media/v4l2-int-device.h
+++ b/include/media/v4l2-int-device.h
@@ -183,6 +183,9 @@ enum v4l2_int_ioctl_num {
183 vidioc_int_s_crop_num, 183 vidioc_int_s_crop_num,
184 vidioc_int_g_parm_num, 184 vidioc_int_g_parm_num,
185 vidioc_int_s_parm_num, 185 vidioc_int_s_parm_num,
186 vidioc_int_querystd_num,
187 vidioc_int_s_std_num,
188 vidioc_int_s_video_routing_num,
186 189
187 /* 190 /*
188 * 191 *
@@ -284,6 +287,9 @@ V4L2_INT_WRAPPER_1(g_crop, struct v4l2_crop, *);
284V4L2_INT_WRAPPER_1(s_crop, struct v4l2_crop, *); 287V4L2_INT_WRAPPER_1(s_crop, struct v4l2_crop, *);
285V4L2_INT_WRAPPER_1(g_parm, struct v4l2_streamparm, *); 288V4L2_INT_WRAPPER_1(g_parm, struct v4l2_streamparm, *);
286V4L2_INT_WRAPPER_1(s_parm, struct v4l2_streamparm, *); 289V4L2_INT_WRAPPER_1(s_parm, struct v4l2_streamparm, *);
290V4L2_INT_WRAPPER_1(querystd, v4l2_std_id, *);
291V4L2_INT_WRAPPER_1(s_std, v4l2_std_id, *);
292V4L2_INT_WRAPPER_1(s_video_routing, struct v4l2_routing, *);
287 293
288V4L2_INT_WRAPPER_0(dev_init); 294V4L2_INT_WRAPPER_0(dev_init);
289V4L2_INT_WRAPPER_0(dev_exit); 295V4L2_INT_WRAPPER_0(dev_exit);
diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h
index e6ba25b3d7c..fcdb58c4ce0 100644
--- a/include/media/v4l2-ioctl.h
+++ b/include/media/v4l2-ioctl.h
@@ -232,6 +232,12 @@ struct v4l2_ioctl_ops {
232 int (*vidioc_g_chip_ident) (struct file *file, void *fh, 232 int (*vidioc_g_chip_ident) (struct file *file, void *fh,
233 struct v4l2_chip_ident *chip); 233 struct v4l2_chip_ident *chip);
234 234
235 int (*vidioc_enum_framesizes) (struct file *file, void *fh,
236 struct v4l2_frmsizeenum *fsize);
237
238 int (*vidioc_enum_frameintervals) (struct file *file, void *fh,
239 struct v4l2_frmivalenum *fival);
240
235 /* For other private ioctls */ 241 /* For other private ioctls */
236 int (*vidioc_default) (struct file *file, void *fh, 242 int (*vidioc_default) (struct file *file, void *fh,
237 int cmd, void *arg); 243 int cmd, void *arg);
@@ -285,15 +291,13 @@ extern long v4l_compat_ioctl32(struct file *file, unsigned int cmd,
285 unsigned long arg); 291 unsigned long arg);
286 292
287/* Include support for obsoleted stuff */ 293/* Include support for obsoleted stuff */
288extern int video_usercopy(struct inode *inode, struct file *file, 294extern int video_usercopy(struct file *file, unsigned int cmd,
289 unsigned int cmd, unsigned long arg, 295 unsigned long arg, v4l2_kioctl func);
290 int (*func)(struct inode *inode, struct file *file,
291 unsigned int cmd, void *arg));
292 296
293/* Standard handlers for V4L ioctl's */ 297/* Standard handlers for V4L ioctl's */
294 298
295/* This prototype is used on fops.unlocked_ioctl */ 299/* This prototype is used on fops.unlocked_ioctl */
296extern int __video_ioctl2(struct file *file, 300extern long __video_ioctl2(struct file *file,
297 unsigned int cmd, unsigned long arg); 301 unsigned int cmd, unsigned long arg);
298 302
299/* This prototype is used on fops.ioctl 303/* This prototype is used on fops.ioctl
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
new file mode 100644
index 00000000000..ceef016bb0b
--- /dev/null
+++ b/include/media/v4l2-subdev.h
@@ -0,0 +1,189 @@
1/*
2 V4L2 sub-device support header.
3
4 Copyright (C) 2008 Hans Verkuil <hverkuil@xs4all.nl>
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#ifndef _V4L2_SUBDEV_H
22#define _V4L2_SUBDEV_H
23
24#include <media/v4l2-common.h>
25
26struct v4l2_device;
27struct v4l2_subdev;
28struct tuner_setup;
29
30/* Sub-devices are devices that are connected somehow to the main bridge
31 device. These devices are usually audio/video muxers/encoders/decoders or
32 sensors and webcam controllers.
33
34 Usually these devices are controlled through an i2c bus, but other busses
35 may also be used.
36
37 The v4l2_subdev struct provides a way of accessing these devices in a
38 generic manner. Most operations that these sub-devices support fall in
39 a few categories: core ops, audio ops, video ops and tuner ops.
40
41 More categories can be added if needed, although this should remain a
42 limited set (no more than approx. 8 categories).
43
44 Each category has its own set of ops that subdev drivers can implement.
45
46 A subdev driver can leave the pointer to the category ops NULL if
47 it does not implement them (e.g. an audio subdev will generally not
48 implement the video category ops). The exception is the core category:
49 this must always be present.
50
51 These ops are all used internally so it is no problem to change, remove
52 or add ops or move ops from one to another category. Currently these
53 ops are based on the original ioctls, but since ops are not limited to
54 one argument there is room for improvement here once all i2c subdev
55 drivers are converted to use these ops.
56 */
57
58/* Core ops: it is highly recommended to implement at least these ops:
59
60 g_chip_ident
61 log_status
62 g_register
63 s_register
64
65 This provides basic debugging support.
66
67 The ioctl ops is meant for generic ioctl-like commands. Depending on
68 the use-case it might be better to use subdev-specific ops (currently
69 not yet implemented) since ops provide proper type-checking.
70 */
71struct v4l2_subdev_core_ops {
72 int (*g_chip_ident)(struct v4l2_subdev *sd, struct v4l2_chip_ident *chip);
73 int (*log_status)(struct v4l2_subdev *sd);
74 int (*init)(struct v4l2_subdev *sd, u32 val);
75 int (*s_standby)(struct v4l2_subdev *sd, u32 standby);
76 int (*reset)(struct v4l2_subdev *sd, u32 val);
77 int (*s_gpio)(struct v4l2_subdev *sd, u32 val);
78 int (*queryctrl)(struct v4l2_subdev *sd, struct v4l2_queryctrl *qc);
79 int (*g_ctrl)(struct v4l2_subdev *sd, struct v4l2_control *ctrl);
80 int (*s_ctrl)(struct v4l2_subdev *sd, struct v4l2_control *ctrl);
81 int (*querymenu)(struct v4l2_subdev *sd, struct v4l2_querymenu *qm);
82 int (*ioctl)(struct v4l2_subdev *sd, unsigned int cmd, void *arg);
83#ifdef CONFIG_VIDEO_ADV_DEBUG
84 int (*g_register)(struct v4l2_subdev *sd, struct v4l2_register *reg);
85 int (*s_register)(struct v4l2_subdev *sd, struct v4l2_register *reg);
86#endif
87};
88
89struct v4l2_subdev_tuner_ops {
90 int (*s_mode)(struct v4l2_subdev *sd, enum v4l2_tuner_type);
91 int (*s_radio)(struct v4l2_subdev *sd);
92 int (*s_frequency)(struct v4l2_subdev *sd, struct v4l2_frequency *freq);
93 int (*g_frequency)(struct v4l2_subdev *sd, struct v4l2_frequency *freq);
94 int (*g_tuner)(struct v4l2_subdev *sd, struct v4l2_tuner *vt);
95 int (*s_tuner)(struct v4l2_subdev *sd, struct v4l2_tuner *vt);
96 int (*s_std)(struct v4l2_subdev *sd, v4l2_std_id norm);
97 int (*s_type_addr)(struct v4l2_subdev *sd, struct tuner_setup *type);
98 int (*s_config)(struct v4l2_subdev *sd, const struct v4l2_priv_tun_config *config);
99};
100
101struct v4l2_subdev_audio_ops {
102 int (*s_clock_freq)(struct v4l2_subdev *sd, u32 freq);
103 int (*s_i2s_clock_freq)(struct v4l2_subdev *sd, u32 freq);
104 int (*s_routing)(struct v4l2_subdev *sd, const struct v4l2_routing *route);
105};
106
107struct v4l2_subdev_video_ops {
108 int (*s_routing)(struct v4l2_subdev *sd, const struct v4l2_routing *route);
109 int (*s_crystal_freq)(struct v4l2_subdev *sd, struct v4l2_crystal_freq *freq);
110 int (*decode_vbi_line)(struct v4l2_subdev *sd, struct v4l2_decode_vbi_line *vbi_line);
111 int (*s_vbi_data)(struct v4l2_subdev *sd, const struct v4l2_sliced_vbi_data *vbi_data);
112 int (*g_vbi_data)(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_data *vbi_data);
113 int (*g_sliced_vbi_cap)(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_cap *cap);
114 int (*s_std_output)(struct v4l2_subdev *sd, v4l2_std_id std);
115 int (*s_stream)(struct v4l2_subdev *sd, int enable);
116 int (*s_fmt)(struct v4l2_subdev *sd, struct v4l2_format *fmt);
117 int (*g_fmt)(struct v4l2_subdev *sd, struct v4l2_format *fmt);
118};
119
120struct v4l2_subdev_ops {
121 const struct v4l2_subdev_core_ops *core;
122 const struct v4l2_subdev_tuner_ops *tuner;
123 const struct v4l2_subdev_audio_ops *audio;
124 const struct v4l2_subdev_video_ops *video;
125};
126
127#define V4L2_SUBDEV_NAME_SIZE 32
128
129/* Each instance of a subdev driver should create this struct, either
130 stand-alone or embedded in a larger struct.
131 */
132struct v4l2_subdev {
133 struct list_head list;
134 struct module *owner;
135 struct v4l2_device *dev;
136 const struct v4l2_subdev_ops *ops;
137 /* name must be unique */
138 char name[V4L2_SUBDEV_NAME_SIZE];
139 /* can be used to group similar subdevs, value is driver-specific */
140 u32 grp_id;
141 /* pointer to private data */
142 void *priv;
143};
144
145static inline void v4l2_set_subdevdata(struct v4l2_subdev *sd, void *p)
146{
147 sd->priv = p;
148}
149
150static inline void *v4l2_get_subdevdata(const struct v4l2_subdev *sd)
151{
152 return sd->priv;
153}
154
155/* Convert an ioctl-type command to the proper v4l2_subdev_ops function call.
156 This is used by subdev modules that can be called by both old-style ioctl
157 commands and through the v4l2_subdev_ops.
158
159 The ioctl API of the subdev driver can call this function to call the
160 right ops based on the ioctl cmd and arg.
161
162 Once all subdev drivers have been converted and all drivers no longer
163 use the ioctl interface, then this function can be removed.
164 */
165int v4l2_subdev_command(struct v4l2_subdev *sd, unsigned cmd, void *arg);
166
167static inline void v4l2_subdev_init(struct v4l2_subdev *sd,
168 const struct v4l2_subdev_ops *ops)
169{
170 INIT_LIST_HEAD(&sd->list);
171 /* ops->core MUST be set */
172 BUG_ON(!ops || !ops->core);
173 sd->ops = ops;
174 sd->dev = NULL;
175 sd->name[0] = '\0';
176 sd->grp_id = 0;
177 sd->priv = NULL;
178}
179
180/* Call an ops of a v4l2_subdev, doing the right checks against
181 NULL pointers.
182
183 Example: err = v4l2_subdev_call(sd, core, g_chip_ident, &chip);
184 */
185#define v4l2_subdev_call(sd, o, f, args...) \
186 (!(sd) ? -ENODEV : (((sd) && (sd)->ops->o && (sd)->ops->o->f) ? \
187 (sd)->ops->o->f((sd) , ##args) : -ENOIOCTLCMD))
188
189#endif
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index 996d12df759..a04f8463ac7 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -54,8 +54,8 @@
54#define SOL_RFCOMM 18 54#define SOL_RFCOMM 18
55 55
56#define BT_INFO(fmt, arg...) printk(KERN_INFO "Bluetooth: " fmt "\n" , ## arg) 56#define BT_INFO(fmt, arg...) printk(KERN_INFO "Bluetooth: " fmt "\n" , ## arg)
57#define BT_DBG(fmt, arg...) printk(KERN_INFO "%s: " fmt "\n" , __func__ , ## arg) 57#define BT_ERR(fmt, arg...) printk(KERN_ERR "%s: " fmt "\n" , __func__ , ## arg)
58#define BT_ERR(fmt, arg...) printk(KERN_ERR "%s: " fmt "\n" , __func__ , ## arg) 58#define BT_DBG(fmt, arg...) pr_debug("%s: " fmt "\n" , __func__ , ## arg)
59 59
60/* Connection and socket states */ 60/* Connection and socket states */
61enum { 61enum {
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 3cc29491931..3645139e68c 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -54,7 +54,7 @@
54 54
55/* HCI device quirks */ 55/* HCI device quirks */
56enum { 56enum {
57 HCI_QUIRK_RESET_ON_INIT, 57 HCI_QUIRK_NO_RESET,
58 HCI_QUIRK_RAW_DEVICE, 58 HCI_QUIRK_RAW_DEVICE,
59 HCI_QUIRK_FIXUP_BUFFER_SIZE 59 HCI_QUIRK_FIXUP_BUFFER_SIZE
60}; 60};
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 0e85ec39b63..23c0ab74ded 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -5,6 +5,8 @@
5#include <linux/skbuff.h> 5#include <linux/skbuff.h>
6#include <linux/nl80211.h> 6#include <linux/nl80211.h>
7#include <net/genetlink.h> 7#include <net/genetlink.h>
8/* remove once we remove the wext stuff */
9#include <net/iw_handler.h>
8 10
9/* 11/*
10 * 802.11 configuration in-kernel interface 12 * 802.11 configuration in-kernel interface
@@ -167,6 +169,9 @@ struct station_parameters {
167 * @STATION_INFO_LLID: @llid filled 169 * @STATION_INFO_LLID: @llid filled
168 * @STATION_INFO_PLID: @plid filled 170 * @STATION_INFO_PLID: @plid filled
169 * @STATION_INFO_PLINK_STATE: @plink_state filled 171 * @STATION_INFO_PLINK_STATE: @plink_state filled
172 * @STATION_INFO_SIGNAL: @signal filled
173 * @STATION_INFO_TX_BITRATE: @tx_bitrate fields are filled
174 * (tx_bitrate, tx_bitrate_flags and tx_bitrate_mcs)
170 */ 175 */
171enum station_info_flags { 176enum station_info_flags {
172 STATION_INFO_INACTIVE_TIME = 1<<0, 177 STATION_INFO_INACTIVE_TIME = 1<<0,
@@ -175,6 +180,39 @@ enum station_info_flags {
175 STATION_INFO_LLID = 1<<3, 180 STATION_INFO_LLID = 1<<3,
176 STATION_INFO_PLID = 1<<4, 181 STATION_INFO_PLID = 1<<4,
177 STATION_INFO_PLINK_STATE = 1<<5, 182 STATION_INFO_PLINK_STATE = 1<<5,
183 STATION_INFO_SIGNAL = 1<<6,
184 STATION_INFO_TX_BITRATE = 1<<7,
185};
186
187/**
188 * enum station_info_rate_flags - bitrate info flags
189 *
190 * Used by the driver to indicate the specific rate transmission
191 * type for 802.11n transmissions.
192 *
193 * @RATE_INFO_FLAGS_MCS: @tx_bitrate_mcs filled
194 * @RATE_INFO_FLAGS_40_MHZ_WIDTH: 40 Mhz width transmission
195 * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval
196 */
197enum rate_info_flags {
198 RATE_INFO_FLAGS_MCS = 1<<0,
199 RATE_INFO_FLAGS_40_MHZ_WIDTH = 1<<1,
200 RATE_INFO_FLAGS_SHORT_GI = 1<<2,
201};
202
203/**
204 * struct rate_info - bitrate information
205 *
206 * Information about a receiving or transmitting bitrate
207 *
208 * @flags: bitflag of flags from &enum rate_info_flags
209 * @mcs: mcs index if struct describes a 802.11n bitrate
210 * @legacy: bitrate in 100kbit/s for 802.11abg
211 */
212struct rate_info {
213 u8 flags;
214 u8 mcs;
215 u16 legacy;
178}; 216};
179 217
180/** 218/**
@@ -189,6 +227,8 @@ enum station_info_flags {
189 * @llid: mesh local link id 227 * @llid: mesh local link id
190 * @plid: mesh peer link id 228 * @plid: mesh peer link id
191 * @plink_state: mesh peer link state 229 * @plink_state: mesh peer link state
230 * @signal: signal strength of last received packet in dBm
231 * @txrate: current unicast bitrate to this station
192 */ 232 */
193struct station_info { 233struct station_info {
194 u32 filled; 234 u32 filled;
@@ -198,6 +238,8 @@ struct station_info {
198 u16 llid; 238 u16 llid;
199 u16 plid; 239 u16 plid;
200 u8 plink_state; 240 u8 plink_state;
241 s8 signal;
242 struct rate_info txrate;
201}; 243};
202 244
203/** 245/**
@@ -280,11 +322,16 @@ struct mpath_info {
280 * (0 = no, 1 = yes, -1 = do not change) 322 * (0 = no, 1 = yes, -1 = do not change)
281 * @use_short_slot_time: Whether the use of short slot time is allowed 323 * @use_short_slot_time: Whether the use of short slot time is allowed
282 * (0 = no, 1 = yes, -1 = do not change) 324 * (0 = no, 1 = yes, -1 = do not change)
325 * @basic_rates: basic rates in IEEE 802.11 format
326 * (or NULL for no change)
327 * @basic_rates_len: number of basic rates
283 */ 328 */
284struct bss_parameters { 329struct bss_parameters {
285 int use_cts_prot; 330 int use_cts_prot;
286 int use_short_preamble; 331 int use_short_preamble;
287 int use_short_slot_time; 332 int use_short_slot_time;
333 u8 *basic_rates;
334 u8 basic_rates_len;
288}; 335};
289 336
290/** 337/**
@@ -331,25 +378,65 @@ struct ieee80211_regdomain {
331 struct ieee80211_reg_rule reg_rules[]; 378 struct ieee80211_reg_rule reg_rules[];
332}; 379};
333 380
334#define MHZ_TO_KHZ(freq) (freq * 1000) 381#define MHZ_TO_KHZ(freq) ((freq) * 1000)
335#define KHZ_TO_MHZ(freq) (freq / 1000) 382#define KHZ_TO_MHZ(freq) ((freq) / 1000)
336#define DBI_TO_MBI(gain) (gain * 100) 383#define DBI_TO_MBI(gain) ((gain) * 100)
337#define MBI_TO_DBI(gain) (gain / 100) 384#define MBI_TO_DBI(gain) ((gain) / 100)
338#define DBM_TO_MBM(gain) (gain * 100) 385#define DBM_TO_MBM(gain) ((gain) * 100)
339#define MBM_TO_DBM(gain) (gain / 100) 386#define MBM_TO_DBM(gain) ((gain) / 100)
340 387
341#define REG_RULE(start, end, bw, gain, eirp, reg_flags) { \ 388#define REG_RULE(start, end, bw, gain, eirp, reg_flags) { \
342 .freq_range.start_freq_khz = (start) * 1000, \ 389 .freq_range.start_freq_khz = MHZ_TO_KHZ(start), \
343 .freq_range.end_freq_khz = (end) * 1000, \ 390 .freq_range.end_freq_khz = MHZ_TO_KHZ(end), \
344 .freq_range.max_bandwidth_khz = (bw) * 1000, \ 391 .freq_range.max_bandwidth_khz = MHZ_TO_KHZ(bw), \
345 .power_rule.max_antenna_gain = (gain) * 100, \ 392 .power_rule.max_antenna_gain = DBI_TO_MBI(gain), \
346 .power_rule.max_eirp = (eirp) * 100, \ 393 .power_rule.max_eirp = DBM_TO_MBM(eirp), \
347 .flags = reg_flags, \ 394 .flags = reg_flags, \
348 } 395 }
349 396
397struct mesh_config {
398 /* Timeouts in ms */
399 /* Mesh plink management parameters */
400 u16 dot11MeshRetryTimeout;
401 u16 dot11MeshConfirmTimeout;
402 u16 dot11MeshHoldingTimeout;
403 u16 dot11MeshMaxPeerLinks;
404 u8 dot11MeshMaxRetries;
405 u8 dot11MeshTTL;
406 bool auto_open_plinks;
407 /* HWMP parameters */
408 u8 dot11MeshHWMPmaxPREQretries;
409 u32 path_refresh_time;
410 u16 min_discovery_timeout;
411 u32 dot11MeshHWMPactivePathTimeout;
412 u16 dot11MeshHWMPpreqMinInterval;
413 u16 dot11MeshHWMPnetDiameterTraversalTime;
414};
415
416/**
417 * struct ieee80211_txq_params - TX queue parameters
418 * @queue: TX queue identifier (NL80211_TXQ_Q_*)
419 * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled
420 * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range
421 * 1..32767]
422 * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range
423 * 1..32767]
424 * @aifs: Arbitration interframe space [0..255]
425 */
426struct ieee80211_txq_params {
427 enum nl80211_txq_q queue;
428 u16 txop;
429 u16 cwmin;
430 u16 cwmax;
431 u8 aifs;
432};
433
350/* from net/wireless.h */ 434/* from net/wireless.h */
351struct wiphy; 435struct wiphy;
352 436
437/* from net/ieee80211.h */
438struct ieee80211_channel;
439
353/** 440/**
354 * struct cfg80211_ops - backend description for wireless configuration 441 * struct cfg80211_ops - backend description for wireless configuration
355 * 442 *
@@ -397,9 +484,19 @@ struct wiphy;
397 * 484 *
398 * @change_station: Modify a given station. 485 * @change_station: Modify a given station.
399 * 486 *
487 * @get_mesh_params: Put the current mesh parameters into *params
488 *
489 * @set_mesh_params: Set mesh parameters.
490 * The mask is a bitfield which tells us which parameters to
491 * set, and which to leave alone.
492 *
400 * @set_mesh_cfg: set mesh parameters (by now, just mesh id) 493 * @set_mesh_cfg: set mesh parameters (by now, just mesh id)
401 * 494 *
402 * @change_bss: Modify parameters for a given BSS. 495 * @change_bss: Modify parameters for a given BSS.
496 *
497 * @set_txq_params: Set TX queue parameters
498 *
499 * @set_channel: Set channel
403 */ 500 */
404struct cfg80211_ops { 501struct cfg80211_ops {
405 int (*add_virtual_intf)(struct wiphy *wiphy, char *name, 502 int (*add_virtual_intf)(struct wiphy *wiphy, char *name,
@@ -452,9 +549,30 @@ struct cfg80211_ops {
452 int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev, 549 int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev,
453 int idx, u8 *dst, u8 *next_hop, 550 int idx, u8 *dst, u8 *next_hop,
454 struct mpath_info *pinfo); 551 struct mpath_info *pinfo);
455 552 int (*get_mesh_params)(struct wiphy *wiphy,
553 struct net_device *dev,
554 struct mesh_config *conf);
555 int (*set_mesh_params)(struct wiphy *wiphy,
556 struct net_device *dev,
557 const struct mesh_config *nconf, u32 mask);
456 int (*change_bss)(struct wiphy *wiphy, struct net_device *dev, 558 int (*change_bss)(struct wiphy *wiphy, struct net_device *dev,
457 struct bss_parameters *params); 559 struct bss_parameters *params);
560
561 int (*set_txq_params)(struct wiphy *wiphy,
562 struct ieee80211_txq_params *params);
563
564 int (*set_channel)(struct wiphy *wiphy,
565 struct ieee80211_channel *chan,
566 enum nl80211_channel_type channel_type);
458}; 567};
459 568
569/* temporary wext handlers */
570int cfg80211_wext_giwname(struct net_device *dev,
571 struct iw_request_info *info,
572 char *name, char *extra);
573int cfg80211_wext_siwmode(struct net_device *dev, struct iw_request_info *info,
574 u32 *mode, char *extra);
575int cfg80211_wext_giwmode(struct net_device *dev, struct iw_request_info *info,
576 u32 *mode, char *extra);
577
460#endif /* __NET_CFG80211_H */ 578#endif /* __NET_CFG80211_H */
diff --git a/include/net/checksum.h b/include/net/checksum.h
index 07602b7fa21..ba55d8b8c87 100644
--- a/include/net/checksum.h
+++ b/include/net/checksum.h
@@ -98,7 +98,7 @@ static inline void csum_replace4(__sum16 *sum, __be32 from, __be32 to)
98{ 98{
99 __be32 diff[] = { ~from, to }; 99 __be32 diff[] = { ~from, to };
100 100
101 *sum = csum_fold(csum_partial((char *)diff, sizeof(diff), ~csum_unfold(*sum))); 101 *sum = csum_fold(csum_partial(diff, sizeof(diff), ~csum_unfold(*sum)));
102} 102}
103 103
104static inline void csum_replace2(__sum16 *sum, __be16 from, __be16 to) 104static inline void csum_replace2(__sum16 *sum, __be16 from, __be16 to)
diff --git a/include/net/dcbnl.h b/include/net/dcbnl.h
new file mode 100644
index 00000000000..775cfc8055b
--- /dev/null
+++ b/include/net/dcbnl.h
@@ -0,0 +1,53 @@
1/*
2 * Copyright (c) 2008, Intel Corporation.
3 *
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,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
15 * Place - Suite 330, Boston, MA 02111-1307 USA.
16 *
17 * Author: Lucy Liu <lucy.liu@intel.com>
18 */
19
20#ifndef __NET_DCBNL_H__
21#define __NET_DCBNL_H__
22
23/*
24 * Ops struct for the netlink callbacks. Used by DCB-enabled drivers through
25 * the netdevice struct.
26 */
27struct dcbnl_rtnl_ops {
28 u8 (*getstate)(struct net_device *);
29 u8 (*setstate)(struct net_device *, u8);
30 void (*getpermhwaddr)(struct net_device *, u8 *);
31 void (*setpgtccfgtx)(struct net_device *, int, u8, u8, u8, u8);
32 void (*setpgbwgcfgtx)(struct net_device *, int, u8);
33 void (*setpgtccfgrx)(struct net_device *, int, u8, u8, u8, u8);
34 void (*setpgbwgcfgrx)(struct net_device *, int, u8);
35 void (*getpgtccfgtx)(struct net_device *, int, u8 *, u8 *, u8 *, u8 *);
36 void (*getpgbwgcfgtx)(struct net_device *, int, u8 *);
37 void (*getpgtccfgrx)(struct net_device *, int, u8 *, u8 *, u8 *, u8 *);
38 void (*getpgbwgcfgrx)(struct net_device *, int, u8 *);
39 void (*setpfccfg)(struct net_device *, int, u8);
40 void (*getpfccfg)(struct net_device *, int, u8 *);
41 u8 (*setall)(struct net_device *);
42 u8 (*getcap)(struct net_device *, int, u8 *);
43 u8 (*getnumtcs)(struct net_device *, int, u8 *);
44 u8 (*setnumtcs)(struct net_device *, int, u8);
45 u8 (*getpfcstate)(struct net_device *);
46 void (*setpfcstate)(struct net_device *, u8);
47 void (*getbcncfg)(struct net_device *, int, u32 *);
48 void (*setbcncfg)(struct net_device *, int, u32);
49 void (*getbcnrp)(struct net_device *, int, u8 *);
50 void (*setbcnrp)(struct net_device *, int, u8);
51};
52
53#endif /* __NET_DCBNL_H__ */
diff --git a/include/net/dn.h b/include/net/dn.h
index 627778384c8..e5469f7b67a 100644
--- a/include/net/dn.h
+++ b/include/net/dn.h
@@ -4,9 +4,7 @@
4#include <linux/dn.h> 4#include <linux/dn.h>
5#include <net/sock.h> 5#include <net/sock.h>
6#include <asm/byteorder.h> 6#include <asm/byteorder.h>
7 7#include <asm/unaligned.h>
8#define dn_ntohs(x) le16_to_cpu(x)
9#define dn_htons(x) cpu_to_le16(x)
10 8
11struct dn_scp /* Session Control Port */ 9struct dn_scp /* Session Control Port */
12{ 10{
@@ -175,7 +173,7 @@ struct dn_skb_cb {
175 173
176static inline __le16 dn_eth2dn(unsigned char *ethaddr) 174static inline __le16 dn_eth2dn(unsigned char *ethaddr)
177{ 175{
178 return dn_htons(ethaddr[4] | (ethaddr[5] << 8)); 176 return get_unaligned((__le16 *)(ethaddr + 4));
179} 177}
180 178
181static inline __le16 dn_saddr2dn(struct sockaddr_dn *saddr) 179static inline __le16 dn_saddr2dn(struct sockaddr_dn *saddr)
@@ -185,7 +183,7 @@ static inline __le16 dn_saddr2dn(struct sockaddr_dn *saddr)
185 183
186static inline void dn_dn2eth(unsigned char *ethaddr, __le16 addr) 184static inline void dn_dn2eth(unsigned char *ethaddr, __le16 addr)
187{ 185{
188 __u16 a = dn_ntohs(addr); 186 __u16 a = le16_to_cpu(addr);
189 ethaddr[0] = 0xAA; 187 ethaddr[0] = 0xAA;
190 ethaddr[1] = 0x00; 188 ethaddr[1] = 0x00;
191 ethaddr[2] = 0x04; 189 ethaddr[2] = 0x04;
diff --git a/include/net/dn_fib.h b/include/net/dn_fib.h
index 30125119c95..c378be7bf96 100644
--- a/include/net/dn_fib.h
+++ b/include/net/dn_fib.h
@@ -181,9 +181,9 @@ static inline void dn_fib_res_put(struct dn_fib_res *res)
181 181
182static inline __le16 dnet_make_mask(int n) 182static inline __le16 dnet_make_mask(int n)
183{ 183{
184 if (n) 184 if (n)
185 return dn_htons(~((1<<(16-n))-1)); 185 return cpu_to_le16(~((1 << (16 - n)) - 1));
186 return 0; 186 return cpu_to_le16(0);
187} 187}
188 188
189#endif /* _NET_DN_FIB_H */ 189#endif /* _NET_DN_FIB_H */
diff --git a/include/net/dst.h b/include/net/dst.h
index 8a8b71e5f3f..6be3b082a07 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -59,8 +59,11 @@ struct dst_entry
59 59
60 struct neighbour *neighbour; 60 struct neighbour *neighbour;
61 struct hh_cache *hh; 61 struct hh_cache *hh;
62#ifdef CONFIG_XFRM
62 struct xfrm_state *xfrm; 63 struct xfrm_state *xfrm;
63 64#else
65 void *__pad1;
66#endif
64 int (*input)(struct sk_buff*); 67 int (*input)(struct sk_buff*);
65 int (*output)(struct sk_buff*); 68 int (*output)(struct sk_buff*);
66 69
@@ -70,8 +73,20 @@ struct dst_entry
70 73
71#ifdef CONFIG_NET_CLS_ROUTE 74#ifdef CONFIG_NET_CLS_ROUTE
72 __u32 tclassid; 75 __u32 tclassid;
76#else
77 __u32 __pad2;
73#endif 78#endif
74 79
80
81 /*
82 * Align __refcnt to a 64 bytes alignment
83 * (L1_CACHE_SIZE would be too much)
84 */
85#ifdef CONFIG_64BIT
86 long __pad_to_align_refcnt[2];
87#else
88 long __pad_to_align_refcnt[1];
89#endif
75 /* 90 /*
76 * __refcnt wants to be on a different cache line from 91 * __refcnt wants to be on a different cache line from
77 * input/output/ops or performance tanks badly 92 * input/output/ops or performance tanks badly
@@ -103,7 +118,6 @@ struct dst_ops
103 void (*link_failure)(struct sk_buff *); 118 void (*link_failure)(struct sk_buff *);
104 void (*update_pmtu)(struct dst_entry *dst, u32 mtu); 119 void (*update_pmtu)(struct dst_entry *dst, u32 mtu);
105 int (*local_out)(struct sk_buff *skb); 120 int (*local_out)(struct sk_buff *skb);
106 int entry_size;
107 121
108 atomic_t entries; 122 atomic_t entries;
109 struct kmem_cache *kmem_cachep; 123 struct kmem_cache *kmem_cachep;
@@ -157,6 +171,11 @@ dst_metric_locked(struct dst_entry *dst, int metric)
157 171
158static inline void dst_hold(struct dst_entry * dst) 172static inline void dst_hold(struct dst_entry * dst)
159{ 173{
174 /*
175 * If your kernel compilation stops here, please check
176 * __pad_to_align_refcnt declaration in struct dst_entry
177 */
178 BUILD_BUG_ON(offsetof(struct dst_entry, __refcnt) & 63);
160 atomic_inc(&dst->__refcnt); 179 atomic_inc(&dst->__refcnt);
161} 180}
162 181
@@ -272,21 +291,21 @@ enum {
272 291
273struct flowi; 292struct flowi;
274#ifndef CONFIG_XFRM 293#ifndef CONFIG_XFRM
275static inline int xfrm_lookup(struct dst_entry **dst_p, struct flowi *fl, 294static inline int xfrm_lookup(struct net *net, struct dst_entry **dst_p,
276 struct sock *sk, int flags) 295 struct flowi *fl, struct sock *sk, int flags)
277{ 296{
278 return 0; 297 return 0;
279} 298}
280static inline int __xfrm_lookup(struct dst_entry **dst_p, struct flowi *fl, 299static inline int __xfrm_lookup(struct net *net, struct dst_entry **dst_p,
281 struct sock *sk, int flags) 300 struct flowi *fl, struct sock *sk, int flags)
282{ 301{
283 return 0; 302 return 0;
284} 303}
285#else 304#else
286extern int xfrm_lookup(struct dst_entry **dst_p, struct flowi *fl, 305extern int xfrm_lookup(struct net *net, struct dst_entry **dst_p,
287 struct sock *sk, int flags); 306 struct flowi *fl, struct sock *sk, int flags);
288extern int __xfrm_lookup(struct dst_entry **dst_p, struct flowi *fl, 307extern int __xfrm_lookup(struct net *net, struct dst_entry **dst_p,
289 struct sock *sk, int flags); 308 struct flowi *fl, struct sock *sk, int flags);
290#endif 309#endif
291#endif 310#endif
292 311
diff --git a/include/net/flow.h b/include/net/flow.h
index b45a5e4fcad..809970b7dfe 100644
--- a/include/net/flow.h
+++ b/include/net/flow.h
@@ -84,12 +84,13 @@ struct flowi {
84#define FLOW_DIR_OUT 1 84#define FLOW_DIR_OUT 1
85#define FLOW_DIR_FWD 2 85#define FLOW_DIR_FWD 2
86 86
87struct net;
87struct sock; 88struct sock;
88typedef int (*flow_resolve_t)(struct flowi *key, u16 family, u8 dir, 89typedef int (*flow_resolve_t)(struct net *net, struct flowi *key, u16 family,
89 void **objp, atomic_t **obj_refp); 90 u8 dir, void **objp, atomic_t **obj_refp);
90 91
91extern void *flow_cache_lookup(struct flowi *key, u16 family, u8 dir, 92extern void *flow_cache_lookup(struct net *net, struct flowi *key, u16 family,
92 flow_resolve_t resolver); 93 u8 dir, flow_resolve_t resolver);
93extern void flow_cache_flush(void); 94extern void flow_cache_flush(void);
94extern atomic_t flow_cache_genid; 95extern atomic_t flow_cache_genid;
95 96
diff --git a/include/net/gen_stats.h b/include/net/gen_stats.h
index 8cd8185fa2e..d136b5240ef 100644
--- a/include/net/gen_stats.h
+++ b/include/net/gen_stats.h
@@ -45,5 +45,6 @@ extern void gen_kill_estimator(struct gnet_stats_basic *bstats,
45extern int gen_replace_estimator(struct gnet_stats_basic *bstats, 45extern int gen_replace_estimator(struct gnet_stats_basic *bstats,
46 struct gnet_stats_rate_est *rate_est, 46 struct gnet_stats_rate_est *rate_est,
47 spinlock_t *stats_lock, struct nlattr *opt); 47 spinlock_t *stats_lock, struct nlattr *opt);
48 48extern bool gen_estimator_active(const struct gnet_stats_basic *bstats,
49 const struct gnet_stats_rate_est *rate_est);
49#endif 50#endif
diff --git a/include/net/ieee80211.h b/include/net/ieee80211.h
index 93a56de3594..adb7cf31f78 100644
--- a/include/net/ieee80211.h
+++ b/include/net/ieee80211.h
@@ -28,6 +28,9 @@
28#include <linux/if_ether.h> /* ETH_ALEN */ 28#include <linux/if_ether.h> /* ETH_ALEN */
29#include <linux/kernel.h> /* ARRAY_SIZE */ 29#include <linux/kernel.h> /* ARRAY_SIZE */
30#include <linux/wireless.h> 30#include <linux/wireless.h>
31#include <linux/ieee80211.h>
32
33#include <net/lib80211.h>
31 34
32#define IEEE80211_VERSION "git-1.1.13" 35#define IEEE80211_VERSION "git-1.1.13"
33 36
@@ -127,10 +130,6 @@ static inline bool ieee80211_ratelimit_debug(u32 level)
127} 130}
128#endif /* CONFIG_IEEE80211_DEBUG */ 131#endif /* CONFIG_IEEE80211_DEBUG */
129 132
130/* escape_essid() is intended to be used in debug (and possibly error)
131 * messages. It should never be used for passing essid to user space. */
132const char *escape_essid(const char *essid, u8 essid_len);
133
134/* 133/*
135 * To use the debug system: 134 * To use the debug system:
136 * 135 *
@@ -218,94 +217,6 @@ struct ieee80211_snap_hdr {
218#define WLAN_GET_SEQ_FRAG(seq) ((seq) & IEEE80211_SCTL_FRAG) 217#define WLAN_GET_SEQ_FRAG(seq) ((seq) & IEEE80211_SCTL_FRAG)
219#define WLAN_GET_SEQ_SEQ(seq) (((seq) & IEEE80211_SCTL_SEQ) >> 4) 218#define WLAN_GET_SEQ_SEQ(seq) (((seq) & IEEE80211_SCTL_SEQ) >> 4)
220 219
221/* Authentication algorithms */
222#define WLAN_AUTH_OPEN 0
223#define WLAN_AUTH_SHARED_KEY 1
224#define WLAN_AUTH_LEAP 2
225
226#define WLAN_AUTH_CHALLENGE_LEN 128
227
228#define WLAN_CAPABILITY_ESS (1<<0)
229#define WLAN_CAPABILITY_IBSS (1<<1)
230#define WLAN_CAPABILITY_CF_POLLABLE (1<<2)
231#define WLAN_CAPABILITY_CF_POLL_REQUEST (1<<3)
232#define WLAN_CAPABILITY_PRIVACY (1<<4)
233#define WLAN_CAPABILITY_SHORT_PREAMBLE (1<<5)
234#define WLAN_CAPABILITY_PBCC (1<<6)
235#define WLAN_CAPABILITY_CHANNEL_AGILITY (1<<7)
236#define WLAN_CAPABILITY_SPECTRUM_MGMT (1<<8)
237#define WLAN_CAPABILITY_QOS (1<<9)
238#define WLAN_CAPABILITY_SHORT_SLOT_TIME (1<<10)
239#define WLAN_CAPABILITY_DSSS_OFDM (1<<13)
240
241/* 802.11g ERP information element */
242#define WLAN_ERP_NON_ERP_PRESENT (1<<0)
243#define WLAN_ERP_USE_PROTECTION (1<<1)
244#define WLAN_ERP_BARKER_PREAMBLE (1<<2)
245
246/* Status codes */
247enum ieee80211_statuscode {
248 WLAN_STATUS_SUCCESS = 0,
249 WLAN_STATUS_UNSPECIFIED_FAILURE = 1,
250 WLAN_STATUS_CAPS_UNSUPPORTED = 10,
251 WLAN_STATUS_REASSOC_NO_ASSOC = 11,
252 WLAN_STATUS_ASSOC_DENIED_UNSPEC = 12,
253 WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG = 13,
254 WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION = 14,
255 WLAN_STATUS_CHALLENGE_FAIL = 15,
256 WLAN_STATUS_AUTH_TIMEOUT = 16,
257 WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA = 17,
258 WLAN_STATUS_ASSOC_DENIED_RATES = 18,
259 /* 802.11b */
260 WLAN_STATUS_ASSOC_DENIED_NOSHORTPREAMBLE = 19,
261 WLAN_STATUS_ASSOC_DENIED_NOPBCC = 20,
262 WLAN_STATUS_ASSOC_DENIED_NOAGILITY = 21,
263 /* 802.11h */
264 WLAN_STATUS_ASSOC_DENIED_NOSPECTRUM = 22,
265 WLAN_STATUS_ASSOC_REJECTED_BAD_POWER = 23,
266 WLAN_STATUS_ASSOC_REJECTED_BAD_SUPP_CHAN = 24,
267 /* 802.11g */
268 WLAN_STATUS_ASSOC_DENIED_NOSHORTTIME = 25,
269 WLAN_STATUS_ASSOC_DENIED_NODSSSOFDM = 26,
270 /* 802.11i */
271 WLAN_STATUS_INVALID_IE = 40,
272 WLAN_STATUS_INVALID_GROUP_CIPHER = 41,
273 WLAN_STATUS_INVALID_PAIRWISE_CIPHER = 42,
274 WLAN_STATUS_INVALID_AKMP = 43,
275 WLAN_STATUS_UNSUPP_RSN_VERSION = 44,
276 WLAN_STATUS_INVALID_RSN_IE_CAP = 45,
277 WLAN_STATUS_CIPHER_SUITE_REJECTED = 46,
278};
279
280/* Reason codes */
281enum ieee80211_reasoncode {
282 WLAN_REASON_UNSPECIFIED = 1,
283 WLAN_REASON_PREV_AUTH_NOT_VALID = 2,
284 WLAN_REASON_DEAUTH_LEAVING = 3,
285 WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY = 4,
286 WLAN_REASON_DISASSOC_AP_BUSY = 5,
287 WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA = 6,
288 WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA = 7,
289 WLAN_REASON_DISASSOC_STA_HAS_LEFT = 8,
290 WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH = 9,
291 /* 802.11h */
292 WLAN_REASON_DISASSOC_BAD_POWER = 10,
293 WLAN_REASON_DISASSOC_BAD_SUPP_CHAN = 11,
294 /* 802.11i */
295 WLAN_REASON_INVALID_IE = 13,
296 WLAN_REASON_MIC_FAILURE = 14,
297 WLAN_REASON_4WAY_HANDSHAKE_TIMEOUT = 15,
298 WLAN_REASON_GROUP_KEY_HANDSHAKE_TIMEOUT = 16,
299 WLAN_REASON_IE_DIFFERENT = 17,
300 WLAN_REASON_INVALID_GROUP_CIPHER = 18,
301 WLAN_REASON_INVALID_PAIRWISE_CIPHER = 19,
302 WLAN_REASON_INVALID_AKMP = 20,
303 WLAN_REASON_UNSUPP_RSN_VERSION = 21,
304 WLAN_REASON_INVALID_RSN_IE_CAP = 22,
305 WLAN_REASON_IEEE8021X_FAILED = 23,
306 WLAN_REASON_CIPHER_SUITE_REJECTED = 24,
307};
308
309/* Action categories - 802.11h */ 220/* Action categories - 802.11h */
310enum ieee80211_actioncategories { 221enum ieee80211_actioncategories {
311 WLAN_ACTION_SPECTRUM_MGMT = 0, 222 WLAN_ACTION_SPECTRUM_MGMT = 0,
@@ -446,8 +357,6 @@ struct ieee80211_stats {
446 357
447struct ieee80211_device; 358struct ieee80211_device;
448 359
449#include "ieee80211_crypt.h"
450
451#define SEC_KEY_1 (1<<0) 360#define SEC_KEY_1 (1<<0)
452#define SEC_KEY_2 (1<<1) 361#define SEC_KEY_2 (1<<1)
453#define SEC_KEY_3 (1<<2) 362#define SEC_KEY_3 (1<<2)
@@ -476,9 +385,8 @@ struct ieee80211_device;
476#define SCM_TEMPORAL_KEY_LENGTH 16 385#define SCM_TEMPORAL_KEY_LENGTH 16
477 386
478struct ieee80211_security { 387struct ieee80211_security {
479 u16 active_key:2, 388 u16 active_key:2, enabled:1, unicast_uses_group:1, encrypt:1;
480 enabled:1, 389 u8 auth_mode;
481 auth_mode:2, auth_algo:4, unicast_uses_group:1, encrypt:1;
482 u8 encode_alg[WEP_KEYS]; 390 u8 encode_alg[WEP_KEYS];
483 u8 key_sizes[WEP_KEYS]; 391 u8 key_sizes[WEP_KEYS];
484 u8 keys[WEP_KEYS][SCM_KEY_LEN]; 392 u8 keys[WEP_KEYS][SCM_KEY_LEN];
@@ -534,15 +442,6 @@ enum ieee80211_mfie {
534 MFIE_TYPE_QOS_PARAMETER = 222, 442 MFIE_TYPE_QOS_PARAMETER = 222,
535}; 443};
536 444
537/* Minimal header; can be used for passing 802.11 frames with sufficient
538 * information to determine what type of underlying data type is actually
539 * stored in the data. */
540struct ieee80211_hdr {
541 __le16 frame_ctl;
542 __le16 duration_id;
543 u8 payload[0];
544} __attribute__ ((packed));
545
546struct ieee80211_hdr_1addr { 445struct ieee80211_hdr_1addr {
547 __le16 frame_ctl; 446 __le16 frame_ctl;
548 __le16 duration_id; 447 __le16 duration_id;
@@ -590,18 +489,6 @@ struct ieee80211_hdr_3addrqos {
590 __le16 qos_ctl; 489 __le16 qos_ctl;
591} __attribute__ ((packed)); 490} __attribute__ ((packed));
592 491
593struct ieee80211_hdr_4addrqos {
594 __le16 frame_ctl;
595 __le16 duration_id;
596 u8 addr1[ETH_ALEN];
597 u8 addr2[ETH_ALEN];
598 u8 addr3[ETH_ALEN];
599 __le16 seq_ctl;
600 u8 addr4[ETH_ALEN];
601 u8 payload[0];
602 __le16 qos_ctl;
603} __attribute__ ((packed));
604
605struct ieee80211_info_element { 492struct ieee80211_info_element {
606 u8 id; 493 u8 id;
607 u8 len; 494 u8 len;
@@ -733,7 +620,6 @@ struct ieee80211_txb {
733 620
734#define MAX_WPA_IE_LEN 64 621#define MAX_WPA_IE_LEN 64
735 622
736#define NETWORK_EMPTY_ESSID (1<<0)
737#define NETWORK_HAS_OFDM (1<<1) 623#define NETWORK_HAS_OFDM (1<<1)
738#define NETWORK_HAS_CCK (1<<2) 624#define NETWORK_HAS_CCK (1<<2)
739 625
@@ -1050,11 +936,7 @@ struct ieee80211_device {
1050 size_t wpa_ie_len; 936 size_t wpa_ie_len;
1051 u8 *wpa_ie; 937 u8 *wpa_ie;
1052 938
1053 struct list_head crypt_deinit_list; 939 struct lib80211_crypt_info crypt_info;
1054 struct ieee80211_crypt_data *crypt[WEP_KEYS];
1055 int tx_keyidx; /* default TX key index (crypt[tx_keyidx]) */
1056 struct timer_list crypt_deinit_timer;
1057 int crypt_quiesced;
1058 940
1059 int bcrx_sta_key; /* use individual keys to override default keys even 941 int bcrx_sta_key; /* use individual keys to override default keys even
1060 * with RX of broad/multicast frames */ 942 * with RX of broad/multicast frames */
@@ -1135,22 +1017,6 @@ static inline void *ieee80211_priv(struct net_device *dev)
1135 return ((struct ieee80211_device *)netdev_priv(dev))->priv; 1017 return ((struct ieee80211_device *)netdev_priv(dev))->priv;
1136} 1018}
1137 1019
1138static inline int ieee80211_is_empty_essid(const char *essid, int essid_len)
1139{
1140 /* Single white space is for Linksys APs */
1141 if (essid_len == 1 && essid[0] == ' ')
1142 return 1;
1143
1144 /* Otherwise, if the entire essid is 0, we assume it is hidden */
1145 while (essid_len) {
1146 essid_len--;
1147 if (essid[essid_len] != '\0')
1148 return 0;
1149 }
1150
1151 return 1;
1152}
1153
1154static inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, 1020static inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee,
1155 int mode) 1021 int mode)
1156{ 1022{
@@ -1208,7 +1074,7 @@ static inline int ieee80211_get_hdrlen(u16 fc)
1208 1074
1209static inline u8 *ieee80211_get_payload(struct ieee80211_hdr *hdr) 1075static inline u8 *ieee80211_get_payload(struct ieee80211_hdr *hdr)
1210{ 1076{
1211 switch (ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl))) { 1077 switch (ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_control))) {
1212 case IEEE80211_1ADDR_LEN: 1078 case IEEE80211_1ADDR_LEN:
1213 return ((struct ieee80211_hdr_1addr *)hdr)->payload; 1079 return ((struct ieee80211_hdr_1addr *)hdr)->payload;
1214 case IEEE80211_2ADDR_LEN: 1080 case IEEE80211_2ADDR_LEN:
diff --git a/include/net/ieee80211_radiotap.h b/include/net/ieee80211_radiotap.h
index d364fd594ea..384698cb773 100644
--- a/include/net/ieee80211_radiotap.h
+++ b/include/net/ieee80211_radiotap.h
@@ -1,7 +1,4 @@
1/* $FreeBSD: src/sys/net80211/ieee80211_radiotap.h,v 1.5 2005/01/22 20:12:05 sam Exp $ */ 1/*
2/* $NetBSD: ieee80211_radiotap.h,v 1.11 2005/06/22 06:16:02 dyoung Exp $ */
3
4/*-
5 * Copyright (c) 2003, 2004 David Young. All rights reserved. 2 * Copyright (c) 2003, 2004 David Young. All rights reserved.
6 * 3 *
7 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
@@ -42,8 +39,6 @@
42#include <linux/kernel.h> 39#include <linux/kernel.h>
43#include <asm/unaligned.h> 40#include <asm/unaligned.h>
44 41
45/* Radiotap header version (from official NetBSD feed) */
46#define IEEE80211RADIOTAP_VERSION "1.5"
47/* Base version of the radiotap packet header data */ 42/* Base version of the radiotap packet header data */
48#define PKTHDR_RADIOTAP_VERSION 0 43#define PKTHDR_RADIOTAP_VERSION 0
49 44
@@ -62,12 +57,8 @@
62 * readers. 57 * readers.
63 */ 58 */
64 59
65/* XXX tcpdump/libpcap do not tolerate variable-length headers, 60/*
66 * yet, so we pad every radiotap header to 64 bytes. Ugh. 61 * The radio capture header precedes the 802.11 header.
67 */
68#define IEEE80211_RADIOTAP_HDRLEN 64
69
70/* The radio capture header precedes the 802.11 header.
71 * All data in the header is little endian on all platforms. 62 * All data in the header is little endian on all platforms.
72 */ 63 */
73struct ieee80211_radiotap_header { 64struct ieee80211_radiotap_header {
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index 5cc182f9eca..f44bb5c77a7 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -41,8 +41,8 @@
41 * I'll experiment with dynamic table growth later. 41 * I'll experiment with dynamic table growth later.
42 */ 42 */
43struct inet_ehash_bucket { 43struct inet_ehash_bucket {
44 struct hlist_head chain; 44 struct hlist_nulls_head chain;
45 struct hlist_head twchain; 45 struct hlist_nulls_head twchain;
46}; 46};
47 47
48/* There are a few simple rules, which allow for local port reuse by 48/* There are a few simple rules, which allow for local port reuse by
@@ -77,13 +77,20 @@ struct inet_ehash_bucket {
77 * ports are created in O(1) time? I thought so. ;-) -DaveM 77 * ports are created in O(1) time? I thought so. ;-) -DaveM
78 */ 78 */
79struct inet_bind_bucket { 79struct inet_bind_bucket {
80#ifdef CONFIG_NET_NS
80 struct net *ib_net; 81 struct net *ib_net;
82#endif
81 unsigned short port; 83 unsigned short port;
82 signed short fastreuse; 84 signed short fastreuse;
83 struct hlist_node node; 85 struct hlist_node node;
84 struct hlist_head owners; 86 struct hlist_head owners;
85}; 87};
86 88
89static inline struct net *ib_net(struct inet_bind_bucket *ib)
90{
91 return read_pnet(&ib->ib_net);
92}
93
87#define inet_bind_bucket_for_each(tb, node, head) \ 94#define inet_bind_bucket_for_each(tb, node, head) \
88 hlist_for_each_entry(tb, node, head, node) 95 hlist_for_each_entry(tb, node, head, node)
89 96
@@ -92,6 +99,18 @@ struct inet_bind_hashbucket {
92 struct hlist_head chain; 99 struct hlist_head chain;
93}; 100};
94 101
102/*
103 * Sockets can be hashed in established or listening table
104 * We must use different 'nulls' end-of-chain value for listening
105 * hash table, or we might find a socket that was closed and
106 * reallocated/inserted into established hash table
107 */
108#define LISTENING_NULLS_BASE (1U << 29)
109struct inet_listen_hashbucket {
110 spinlock_t lock;
111 struct hlist_nulls_head head;
112};
113
95/* This is for listening sockets, thus all sockets which possess wildcards. */ 114/* This is for listening sockets, thus all sockets which possess wildcards. */
96#define INET_LHTABLE_SIZE 32 /* Yes, really, this is all you need. */ 115#define INET_LHTABLE_SIZE 32 /* Yes, really, this is all you need. */
97 116
@@ -104,7 +123,7 @@ struct inet_hashinfo {
104 * TIME_WAIT sockets use a separate chain (twchain). 123 * TIME_WAIT sockets use a separate chain (twchain).
105 */ 124 */
106 struct inet_ehash_bucket *ehash; 125 struct inet_ehash_bucket *ehash;
107 rwlock_t *ehash_locks; 126 spinlock_t *ehash_locks;
108 unsigned int ehash_size; 127 unsigned int ehash_size;
109 unsigned int ehash_locks_mask; 128 unsigned int ehash_locks_mask;
110 129
@@ -116,22 +135,21 @@ struct inet_hashinfo {
116 unsigned int bhash_size; 135 unsigned int bhash_size;
117 /* Note : 4 bytes padding on 64 bit arches */ 136 /* Note : 4 bytes padding on 64 bit arches */
118 137
119 /* All sockets in TCP_LISTEN state will be in here. This is the only 138 struct kmem_cache *bind_bucket_cachep;
120 * table where wildcard'd TCP sockets can exist. Hash function here
121 * is just local port number.
122 */
123 struct hlist_head listening_hash[INET_LHTABLE_SIZE];
124 139
125 /* All the above members are written once at bootup and 140 /* All the above members are written once at bootup and
126 * never written again _or_ are predominantly read-access. 141 * never written again _or_ are predominantly read-access.
127 * 142 *
128 * Now align to a new cache line as all the following members 143 * Now align to a new cache line as all the following members
129 * are often dirty. 144 * might be often dirty.
130 */ 145 */
131 rwlock_t lhash_lock ____cacheline_aligned; 146 /* All sockets in TCP_LISTEN state will be in here. This is the only
132 atomic_t lhash_users; 147 * table where wildcard'd TCP sockets can exist. Hash function here
133 wait_queue_head_t lhash_wait; 148 * is just local port number.
134 struct kmem_cache *bind_bucket_cachep; 149 */
150 struct inet_listen_hashbucket listening_hash[INET_LHTABLE_SIZE]
151 ____cacheline_aligned_in_smp;
152
135}; 153};
136 154
137static inline struct inet_ehash_bucket *inet_ehash_bucket( 155static inline struct inet_ehash_bucket *inet_ehash_bucket(
@@ -141,7 +159,7 @@ static inline struct inet_ehash_bucket *inet_ehash_bucket(
141 return &hashinfo->ehash[hash & (hashinfo->ehash_size - 1)]; 159 return &hashinfo->ehash[hash & (hashinfo->ehash_size - 1)];
142} 160}
143 161
144static inline rwlock_t *inet_ehash_lockp( 162static inline spinlock_t *inet_ehash_lockp(
145 struct inet_hashinfo *hashinfo, 163 struct inet_hashinfo *hashinfo,
146 unsigned int hash) 164 unsigned int hash)
147{ 165{
@@ -166,16 +184,16 @@ static inline int inet_ehash_locks_alloc(struct inet_hashinfo *hashinfo)
166 size = 4096; 184 size = 4096;
167 if (sizeof(rwlock_t) != 0) { 185 if (sizeof(rwlock_t) != 0) {
168#ifdef CONFIG_NUMA 186#ifdef CONFIG_NUMA
169 if (size * sizeof(rwlock_t) > PAGE_SIZE) 187 if (size * sizeof(spinlock_t) > PAGE_SIZE)
170 hashinfo->ehash_locks = vmalloc(size * sizeof(rwlock_t)); 188 hashinfo->ehash_locks = vmalloc(size * sizeof(spinlock_t));
171 else 189 else
172#endif 190#endif
173 hashinfo->ehash_locks = kmalloc(size * sizeof(rwlock_t), 191 hashinfo->ehash_locks = kmalloc(size * sizeof(spinlock_t),
174 GFP_KERNEL); 192 GFP_KERNEL);
175 if (!hashinfo->ehash_locks) 193 if (!hashinfo->ehash_locks)
176 return ENOMEM; 194 return ENOMEM;
177 for (i = 0; i < size; i++) 195 for (i = 0; i < size; i++)
178 rwlock_init(&hashinfo->ehash_locks[i]); 196 spin_lock_init(&hashinfo->ehash_locks[i]);
179 } 197 }
180 hashinfo->ehash_locks_mask = size - 1; 198 hashinfo->ehash_locks_mask = size - 1;
181 return 0; 199 return 0;
@@ -186,7 +204,7 @@ static inline void inet_ehash_locks_free(struct inet_hashinfo *hashinfo)
186 if (hashinfo->ehash_locks) { 204 if (hashinfo->ehash_locks) {
187#ifdef CONFIG_NUMA 205#ifdef CONFIG_NUMA
188 unsigned int size = (hashinfo->ehash_locks_mask + 1) * 206 unsigned int size = (hashinfo->ehash_locks_mask + 1) *
189 sizeof(rwlock_t); 207 sizeof(spinlock_t);
190 if (size > PAGE_SIZE) 208 if (size > PAGE_SIZE)
191 vfree(hashinfo->ehash_locks); 209 vfree(hashinfo->ehash_locks);
192 else 210 else
@@ -229,26 +247,7 @@ extern void __inet_inherit_port(struct sock *sk, struct sock *child);
229 247
230extern void inet_put_port(struct sock *sk); 248extern void inet_put_port(struct sock *sk);
231 249
232extern void inet_listen_wlock(struct inet_hashinfo *hashinfo); 250void inet_hashinfo_init(struct inet_hashinfo *h);
233
234/*
235 * - We may sleep inside this lock.
236 * - If sleeping is not required (or called from BH),
237 * use plain read_(un)lock(&inet_hashinfo.lhash_lock).
238 */
239static inline void inet_listen_lock(struct inet_hashinfo *hashinfo)
240{
241 /* read_lock synchronizes to candidates to writers */
242 read_lock(&hashinfo->lhash_lock);
243 atomic_inc(&hashinfo->lhash_users);
244 read_unlock(&hashinfo->lhash_lock);
245}
246
247static inline void inet_listen_unlock(struct inet_hashinfo *hashinfo)
248{
249 if (atomic_dec_and_test(&hashinfo->lhash_users))
250 wake_up(&hashinfo->lhash_wait);
251}
252 251
253extern void __inet_hash_nolisten(struct sock *sk); 252extern void __inet_hash_nolisten(struct sock *sk);
254extern void inet_hash(struct sock *sk); 253extern void inet_hash(struct sock *sk);
@@ -299,25 +298,25 @@ typedef __u64 __bitwise __addrpair;
299 ((__force __u64)(__be32)(__saddr))); 298 ((__force __u64)(__be32)(__saddr)));
300#endif /* __BIG_ENDIAN */ 299#endif /* __BIG_ENDIAN */
301#define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\ 300#define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\
302 (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \ 301 (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \
303 ((*((__addrpair *)&(inet_sk(__sk)->daddr))) == (__cookie)) && \ 302 ((*((__addrpair *)&(inet_sk(__sk)->daddr))) == (__cookie)) && \
304 ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \ 303 ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \
305 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) 304 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
306#define INET_TW_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\ 305#define INET_TW_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\
307 (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \ 306 (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \
308 ((*((__addrpair *)&(inet_twsk(__sk)->tw_daddr))) == (__cookie)) && \ 307 ((*((__addrpair *)&(inet_twsk(__sk)->tw_daddr))) == (__cookie)) && \
309 ((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \ 308 ((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \
310 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) 309 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
311#else /* 32-bit arch */ 310#else /* 32-bit arch */
312#define INET_ADDR_COOKIE(__name, __saddr, __daddr) 311#define INET_ADDR_COOKIE(__name, __saddr, __daddr)
313#define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif) \ 312#define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif) \
314 (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \ 313 (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \
315 (inet_sk(__sk)->daddr == (__saddr)) && \ 314 (inet_sk(__sk)->daddr == (__saddr)) && \
316 (inet_sk(__sk)->rcv_saddr == (__daddr)) && \ 315 (inet_sk(__sk)->rcv_saddr == (__daddr)) && \
317 ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \ 316 ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \
318 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) 317 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
319#define INET_TW_MATCH(__sk, __net, __hash,__cookie, __saddr, __daddr, __ports, __dif) \ 318#define INET_TW_MATCH(__sk, __net, __hash,__cookie, __saddr, __daddr, __ports, __dif) \
320 (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \ 319 (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \
321 (inet_twsk(__sk)->tw_daddr == (__saddr)) && \ 320 (inet_twsk(__sk)->tw_daddr == (__saddr)) && \
322 (inet_twsk(__sk)->tw_rcv_saddr == (__daddr)) && \ 321 (inet_twsk(__sk)->tw_rcv_saddr == (__daddr)) && \
323 ((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \ 322 ((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h
index 80e4977631b..4b8ece22b8e 100644
--- a/include/net/inet_timewait_sock.h
+++ b/include/net/inet_timewait_sock.h
@@ -110,7 +110,7 @@ struct inet_timewait_sock {
110#define tw_state __tw_common.skc_state 110#define tw_state __tw_common.skc_state
111#define tw_reuse __tw_common.skc_reuse 111#define tw_reuse __tw_common.skc_reuse
112#define tw_bound_dev_if __tw_common.skc_bound_dev_if 112#define tw_bound_dev_if __tw_common.skc_bound_dev_if
113#define tw_node __tw_common.skc_node 113#define tw_node __tw_common.skc_nulls_node
114#define tw_bind_node __tw_common.skc_bind_node 114#define tw_bind_node __tw_common.skc_bind_node
115#define tw_refcnt __tw_common.skc_refcnt 115#define tw_refcnt __tw_common.skc_refcnt
116#define tw_hash __tw_common.skc_hash 116#define tw_hash __tw_common.skc_hash
@@ -137,10 +137,10 @@ struct inet_timewait_sock {
137 struct hlist_node tw_death_node; 137 struct hlist_node tw_death_node;
138}; 138};
139 139
140static inline void inet_twsk_add_node(struct inet_timewait_sock *tw, 140static inline void inet_twsk_add_node_rcu(struct inet_timewait_sock *tw,
141 struct hlist_head *list) 141 struct hlist_nulls_head *list)
142{ 142{
143 hlist_add_head(&tw->tw_node, list); 143 hlist_nulls_add_head_rcu(&tw->tw_node, list);
144} 144}
145 145
146static inline void inet_twsk_add_bind_node(struct inet_timewait_sock *tw, 146static inline void inet_twsk_add_bind_node(struct inet_timewait_sock *tw,
@@ -175,7 +175,7 @@ static inline int inet_twsk_del_dead_node(struct inet_timewait_sock *tw)
175} 175}
176 176
177#define inet_twsk_for_each(tw, node, head) \ 177#define inet_twsk_for_each(tw, node, head) \
178 hlist_for_each_entry(tw, node, head, tw_node) 178 hlist_nulls_for_each_entry(tw, node, head, tw_node)
179 179
180#define inet_twsk_for_each_inmate(tw, node, jail) \ 180#define inet_twsk_for_each_inmate(tw, node, jail) \
181 hlist_for_each_entry(tw, node, jail, tw_death_node) 181 hlist_for_each_entry(tw, node, jail, tw_death_node)
diff --git a/include/net/ip.h b/include/net/ip.h
index bc026ecb513..10868139e65 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -110,7 +110,7 @@ extern int ip_append_data(struct sock *sk,
110 int odd, struct sk_buff *skb), 110 int odd, struct sk_buff *skb),
111 void *from, int len, int protolen, 111 void *from, int len, int protolen,
112 struct ipcm_cookie *ipc, 112 struct ipcm_cookie *ipc,
113 struct rtable *rt, 113 struct rtable **rt,
114 unsigned int flags); 114 unsigned int flags);
115extern int ip_generic_getfrag(void *from, char *to, int offset, int len, int odd, struct sk_buff *skb); 115extern int ip_generic_getfrag(void *from, char *to, int offset, int len, int odd, struct sk_buff *skb);
116extern ssize_t ip_append_page(struct sock *sk, struct page *page, 116extern ssize_t ip_append_page(struct sock *sk, struct page *page,
@@ -187,6 +187,7 @@ extern void inet_get_local_port_range(int *low, int *high);
187extern int sysctl_ip_default_ttl; 187extern int sysctl_ip_default_ttl;
188extern int sysctl_ip_nonlocal_bind; 188extern int sysctl_ip_nonlocal_bind;
189 189
190extern struct ctl_path net_core_path[];
190extern struct ctl_path net_ipv4_ctl_path[]; 191extern struct ctl_path net_ipv4_ctl_path[];
191 192
192/* From inetpeer.c */ 193/* From inetpeer.c */
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index fe9fcf73c85..ab9b003ab67 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -87,12 +87,12 @@ static inline const char *ip_vs_dbg_addr(int af, char *buf, size_t buf_len,
87 int len; 87 int len;
88#ifdef CONFIG_IP_VS_IPV6 88#ifdef CONFIG_IP_VS_IPV6
89 if (af == AF_INET6) 89 if (af == AF_INET6)
90 len = snprintf(&buf[*idx], buf_len - *idx, "[" NIP6_FMT "]", 90 len = snprintf(&buf[*idx], buf_len - *idx, "[%pI6]",
91 NIP6(addr->in6)) + 1; 91 &addr->in6) + 1;
92 else 92 else
93#endif 93#endif
94 len = snprintf(&buf[*idx], buf_len - *idx, NIPQUAD_FMT, 94 len = snprintf(&buf[*idx], buf_len - *idx, "%pI4",
95 NIPQUAD(addr->ip)) + 1; 95 &addr->ip) + 1;
96 96
97 *idx += len; 97 *idx += len;
98 BUG_ON(*idx > buf_len + 1); 98 BUG_ON(*idx > buf_len + 1);
@@ -503,9 +503,6 @@ struct ip_vs_scheduler {
503 char *name; /* scheduler name */ 503 char *name; /* scheduler name */
504 atomic_t refcnt; /* reference counter */ 504 atomic_t refcnt; /* reference counter */
505 struct module *module; /* THIS_MODULE/NULL */ 505 struct module *module; /* THIS_MODULE/NULL */
506#ifdef CONFIG_IP_VS_IPV6
507 int supports_ipv6; /* scheduler has IPv6 support */
508#endif
509 506
510 /* scheduler initializing service */ 507 /* scheduler initializing service */
511 int (*init_service)(struct ip_vs_service *svc); 508 int (*init_service)(struct ip_vs_service *svc);
@@ -916,7 +913,7 @@ static inline __wsum ip_vs_check_diff4(__be32 old, __be32 new, __wsum oldsum)
916{ 913{
917 __be32 diff[2] = { ~old, new }; 914 __be32 diff[2] = { ~old, new };
918 915
919 return csum_partial((char *) diff, sizeof(diff), oldsum); 916 return csum_partial(diff, sizeof(diff), oldsum);
920} 917}
921 918
922#ifdef CONFIG_IP_VS_IPV6 919#ifdef CONFIG_IP_VS_IPV6
@@ -926,7 +923,7 @@ static inline __wsum ip_vs_check_diff16(const __be32 *old, const __be32 *new,
926 __be32 diff[8] = { ~old[3], ~old[2], ~old[1], ~old[0], 923 __be32 diff[8] = { ~old[3], ~old[2], ~old[1], ~old[0],
927 new[3], new[2], new[1], new[0] }; 924 new[3], new[2], new[1], new[0] };
928 925
929 return csum_partial((char *) diff, sizeof(diff), oldsum); 926 return csum_partial(diff, sizeof(diff), oldsum);
930} 927}
931#endif 928#endif
932 929
@@ -934,7 +931,7 @@ static inline __wsum ip_vs_check_diff2(__be16 old, __be16 new, __wsum oldsum)
934{ 931{
935 __be16 diff[2] = { ~old, new }; 932 __be16 diff[2] = { ~old, new };
936 933
937 return csum_partial((char *) diff, sizeof(diff), oldsum); 934 return csum_partial(diff, sizeof(diff), oldsum);
938} 935}
939 936
940#endif /* __KERNEL__ */ 937#endif /* __KERNEL__ */
diff --git a/include/net/irda/irda_device.h b/include/net/irda/irda_device.h
index 3025ae17ddb..94c852d47d0 100644
--- a/include/net/irda/irda_device.h
+++ b/include/net/irda/irda_device.h
@@ -135,9 +135,11 @@ struct dongle_reg {
135 135
136/* 136/*
137 * Per-packet information we need to hide inside sk_buff 137 * Per-packet information we need to hide inside sk_buff
138 * (must not exceed 48 bytes, check with struct sk_buff) 138 * (must not exceed 48 bytes, check with struct sk_buff)
139 * The default_qdisc_pad field is a temporary hack.
139 */ 140 */
140struct irda_skb_cb { 141struct irda_skb_cb {
142 unsigned int default_qdisc_pad;
141 magic_t magic; /* Be sure that we can trust the information */ 143 magic_t magic; /* Be sure that we can trust the information */
142 __u32 next_speed; /* The Speed to be set *after* this frame */ 144 __u32 next_speed; /* The Speed to be set *after* this frame */
143 __u16 mtt; /* Minimum turn around time */ 145 __u16 mtt; /* Minimum turn around time */
diff --git a/include/net/iucv/iucv.h b/include/net/iucv/iucv.h
index fd70adbb356..5e310c8d8e2 100644
--- a/include/net/iucv/iucv.h
+++ b/include/net/iucv/iucv.h
@@ -337,12 +337,35 @@ int iucv_message_purge(struct iucv_path *path, struct iucv_message *msg,
337 * established paths. This function will deal with RMDATA messages 337 * established paths. This function will deal with RMDATA messages
338 * embedded in struct iucv_message as well. 338 * embedded in struct iucv_message as well.
339 * 339 *
340 * Locking: local_bh_enable/local_bh_disable
341 *
340 * Returns the result from the CP IUCV call. 342 * Returns the result from the CP IUCV call.
341 */ 343 */
342int iucv_message_receive(struct iucv_path *path, struct iucv_message *msg, 344int iucv_message_receive(struct iucv_path *path, struct iucv_message *msg,
343 u8 flags, void *buffer, size_t size, size_t *residual); 345 u8 flags, void *buffer, size_t size, size_t *residual);
344 346
345/** 347/**
348 * __iucv_message_receive
349 * @path: address of iucv path structure
350 * @msg: address of iucv msg structure
351 * @flags: flags that affect how the message is received (IUCV_IPBUFLST)
352 * @buffer: address of data buffer or address of struct iucv_array
353 * @size: length of data buffer
354 * @residual:
355 *
356 * This function receives messages that are being sent to you over
357 * established paths. This function will deal with RMDATA messages
358 * embedded in struct iucv_message as well.
359 *
360 * Locking: no locking.
361 *
362 * Returns the result from the CP IUCV call.
363 */
364int __iucv_message_receive(struct iucv_path *path, struct iucv_message *msg,
365 u8 flags, void *buffer, size_t size,
366 size_t *residual);
367
368/**
346 * iucv_message_reject 369 * iucv_message_reject
347 * @path: address of iucv path structure 370 * @path: address of iucv path structure
348 * @msg: address of iucv msg structure 371 * @msg: address of iucv msg structure
@@ -386,12 +409,34 @@ int iucv_message_reply(struct iucv_path *path, struct iucv_message *msg,
386 * transmitted is in a buffer and this is a one-way message and the 409 * transmitted is in a buffer and this is a one-way message and the
387 * receiver will not reply to the message. 410 * receiver will not reply to the message.
388 * 411 *
412 * Locking: local_bh_enable/local_bh_disable
413 *
389 * Returns the result from the CP IUCV call. 414 * Returns the result from the CP IUCV call.
390 */ 415 */
391int iucv_message_send(struct iucv_path *path, struct iucv_message *msg, 416int iucv_message_send(struct iucv_path *path, struct iucv_message *msg,
392 u8 flags, u32 srccls, void *buffer, size_t size); 417 u8 flags, u32 srccls, void *buffer, size_t size);
393 418
394/** 419/**
420 * __iucv_message_send
421 * @path: address of iucv path structure
422 * @msg: address of iucv msg structure
423 * @flags: how the message is sent (IUCV_IPRMDATA, IUCV_IPPRTY, IUCV_IPBUFLST)
424 * @srccls: source class of message
425 * @buffer: address of data buffer or address of struct iucv_array
426 * @size: length of send buffer
427 *
428 * This function transmits data to another application. Data to be
429 * transmitted is in a buffer and this is a one-way message and the
430 * receiver will not reply to the message.
431 *
432 * Locking: no locking.
433 *
434 * Returns the result from the CP IUCV call.
435 */
436int __iucv_message_send(struct iucv_path *path, struct iucv_message *msg,
437 u8 flags, u32 srccls, void *buffer, size_t size);
438
439/**
395 * iucv_message_send2way 440 * iucv_message_send2way
396 * @path: address of iucv path structure 441 * @path: address of iucv path structure
397 * @msg: address of iucv msg structure 442 * @msg: address of iucv msg structure
diff --git a/include/net/ieee80211_crypt.h b/include/net/lib80211.h
index b3d65e0bedd..fb4e2784857 100644
--- a/include/net/ieee80211_crypt.h
+++ b/include/net/lib80211.h
@@ -1,4 +1,11 @@
1/* 1/*
2 * lib80211.h -- common bits for IEEE802.11 wireless drivers
3 *
4 * Copyright (c) 2008, John W. Linville <linville@tuxdriver.com>
5 *
6 * Some bits copied from old ieee80211 component, w/ original copyright
7 * notices below:
8 *
2 * Original code based on Host AP (software wireless LAN access point) driver 9 * Original code based on Host AP (software wireless LAN access point) driver
3 * for Intersil Prism2/2.5/3. 10 * for Intersil Prism2/2.5/3.
4 * 11 *
@@ -11,31 +18,31 @@
11 * 18 *
12 * Copyright (c) 2004, Intel Corporation 19 * Copyright (c) 2004, Intel Corporation
13 * 20 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License version 2 as
16 * published by the Free Software Foundation. See README and COPYING for
17 * more details.
18 */ 21 */
19 22
20/* 23#ifndef LIB80211_H
21 * This file defines the interface to the ieee80211 crypto module. 24#define LIB80211_H
22 */
23#ifndef IEEE80211_CRYPT_H
24#define IEEE80211_CRYPT_H
25 25
26#include <linux/types.h> 26#include <linux/types.h>
27#include <linux/list.h> 27#include <linux/list.h>
28#include <net/ieee80211.h> 28#include <linux/module.h>
29#include <asm/atomic.h> 29#include <asm/atomic.h>
30#include <linux/if.h>
31#include <linux/skbuff.h>
32#include <linux/ieee80211.h>
33#include <linux/timer.h>
34/* print_ssid() is intended to be used in debug (and possibly error)
35 * messages. It should never be used for passing ssid to user space. */
36const char *print_ssid(char *buf, const char *ssid, u8 ssid_len);
37#define DECLARE_SSID_BUF(var) char var[IEEE80211_MAX_SSID_LEN * 4 + 1] __maybe_unused
38
39#define NUM_WEP_KEYS 4
30 40
31enum { 41enum {
32 IEEE80211_CRYPTO_TKIP_COUNTERMEASURES = (1 << 0), 42 IEEE80211_CRYPTO_TKIP_COUNTERMEASURES = (1 << 0),
33}; 43};
34 44
35struct sk_buff; 45struct lib80211_crypto_ops {
36struct module;
37
38struct ieee80211_crypto_ops {
39 const char *name; 46 const char *name;
40 struct list_head list; 47 struct list_head list;
41 48
@@ -87,22 +94,36 @@ struct ieee80211_crypto_ops {
87 struct module *owner; 94 struct module *owner;
88}; 95};
89 96
90struct ieee80211_crypt_data { 97struct lib80211_crypt_data {
91 struct list_head list; /* delayed deletion list */ 98 struct list_head list; /* delayed deletion list */
92 struct ieee80211_crypto_ops *ops; 99 struct lib80211_crypto_ops *ops;
93 void *priv; 100 void *priv;
94 atomic_t refcnt; 101 atomic_t refcnt;
95}; 102};
96 103
97struct ieee80211_device; 104struct lib80211_crypt_info {
98 105 char *name;
99int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops); 106 /* Most clients will already have a lock,
100int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops); 107 so just point to that. */
101struct ieee80211_crypto_ops *ieee80211_get_crypto_ops(const char *name); 108 spinlock_t *lock;
102void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int); 109
103void ieee80211_crypt_deinit_handler(unsigned long); 110 struct lib80211_crypt_data *crypt[NUM_WEP_KEYS];
104void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee, 111 int tx_keyidx; /* default TX key index (crypt[tx_keyidx]) */
105 struct ieee80211_crypt_data **crypt); 112 struct list_head crypt_deinit_list;
106void ieee80211_crypt_quiescing(struct ieee80211_device *ieee); 113 struct timer_list crypt_deinit_timer;
114 int crypt_quiesced;
115};
107 116
108#endif 117int lib80211_crypt_info_init(struct lib80211_crypt_info *info, char *name,
118 spinlock_t *lock);
119void lib80211_crypt_info_free(struct lib80211_crypt_info *info);
120int lib80211_register_crypto_ops(struct lib80211_crypto_ops *ops);
121int lib80211_unregister_crypto_ops(struct lib80211_crypto_ops *ops);
122struct lib80211_crypto_ops *lib80211_get_crypto_ops(const char *name);
123void lib80211_crypt_deinit_entries(struct lib80211_crypt_info *, int);
124void lib80211_crypt_deinit_handler(unsigned long);
125void lib80211_crypt_delayed_deinit(struct lib80211_crypt_info *info,
126 struct lib80211_crypt_data **crypt);
127void lib80211_crypt_quiescing(struct lib80211_crypt_info *info);
128
129#endif /* LIB80211_H */
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 73d81bc6aa7..b3bd00a9d99 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright 2002-2005, Devicescape Software, Inc. 4 * Copyright 2002-2005, Devicescape Software, Inc.
5 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> 5 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
6 * Copyright 2007 Johannes Berg <johannes@sipsolutions.net> 6 * Copyright 2007-2008 Johannes Berg <johannes@sipsolutions.net>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as 9 * it under the terms of the GNU General Public License version 2 as
@@ -107,7 +107,7 @@ enum ieee80211_max_queues {
107 * The information provided in this structure is required for QoS 107 * The information provided in this structure is required for QoS
108 * transmit queue configuration. Cf. IEEE 802.11 7.3.2.29. 108 * transmit queue configuration. Cf. IEEE 802.11 7.3.2.29.
109 * 109 *
110 * @aifs: arbitration interface space [0..255] 110 * @aifs: arbitration interframe space [0..255]
111 * @cw_min: minimum contention window [a value of the form 111 * @cw_min: minimum contention window [a value of the form
112 * 2^n-1 in the range 1..32767] 112 * 2^n-1 in the range 1..32767]
113 * @cw_max: maximum contention window [like @cw_min] 113 * @cw_max: maximum contention window [like @cw_min]
@@ -164,6 +164,14 @@ enum ieee80211_bss_change {
164}; 164};
165 165
166/** 166/**
167 * struct ieee80211_bss_ht_conf - BSS's changing HT configuration
168 * @operation_mode: HT operation mode (like in &struct ieee80211_ht_info)
169 */
170struct ieee80211_bss_ht_conf {
171 u16 operation_mode;
172};
173
174/**
167 * struct ieee80211_bss_conf - holds the BSS's changing parameters 175 * struct ieee80211_bss_conf - holds the BSS's changing parameters
168 * 176 *
169 * This structure keeps information about a BSS (and an association 177 * This structure keeps information about a BSS (and an association
@@ -172,15 +180,17 @@ enum ieee80211_bss_change {
172 * @assoc: association status 180 * @assoc: association status
173 * @aid: association ID number, valid only when @assoc is true 181 * @aid: association ID number, valid only when @assoc is true
174 * @use_cts_prot: use CTS protection 182 * @use_cts_prot: use CTS protection
175 * @use_short_preamble: use 802.11b short preamble 183 * @use_short_preamble: use 802.11b short preamble;
176 * @use_short_slot: use short slot time (only relevant for ERP) 184 * if the hardware cannot handle this it must set the
185 * IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE hardware flag
186 * @use_short_slot: use short slot time (only relevant for ERP);
187 * if the hardware cannot handle this it must set the
188 * IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE hardware flag
177 * @dtim_period: num of beacons before the next DTIM, for PSM 189 * @dtim_period: num of beacons before the next DTIM, for PSM
178 * @timestamp: beacon timestamp 190 * @timestamp: beacon timestamp
179 * @beacon_int: beacon interval 191 * @beacon_int: beacon interval
180 * @assoc_capability: capabilities taken from assoc resp 192 * @assoc_capability: capabilities taken from assoc resp
181 * @assoc_ht: association in HT mode 193 * @ht: BSS's HT configuration
182 * @ht_conf: ht capabilities
183 * @ht_bss_conf: ht extended capabilities
184 * @basic_rates: bitmap of basic rates, each bit stands for an 194 * @basic_rates: bitmap of basic rates, each bit stands for an
185 * index into the rate table configured by the driver in 195 * index into the rate table configured by the driver in
186 * the current band. 196 * the current band.
@@ -198,10 +208,7 @@ struct ieee80211_bss_conf {
198 u16 assoc_capability; 208 u16 assoc_capability;
199 u64 timestamp; 209 u64 timestamp;
200 u64 basic_rates; 210 u64 basic_rates;
201 /* ht related data */ 211 struct ieee80211_bss_ht_conf ht;
202 bool assoc_ht;
203 struct ieee80211_ht_info *ht_conf;
204 struct ieee80211_ht_bss_info *ht_bss_conf;
205}; 212};
206 213
207/** 214/**
@@ -210,29 +217,24 @@ struct ieee80211_bss_conf {
210 * These flags are used with the @flags member of &ieee80211_tx_info. 217 * These flags are used with the @flags member of &ieee80211_tx_info.
211 * 218 *
212 * @IEEE80211_TX_CTL_REQ_TX_STATUS: request TX status callback for this frame. 219 * @IEEE80211_TX_CTL_REQ_TX_STATUS: request TX status callback for this frame.
213 * @IEEE80211_TX_CTL_USE_RTS_CTS: use RTS-CTS before sending frame 220 * @IEEE80211_TX_CTL_ASSIGN_SEQ: The driver has to assign a sequence
214 * @IEEE80211_TX_CTL_USE_CTS_PROTECT: use CTS protection for the frame (e.g., 221 * number to this frame, taking care of not overwriting the fragment
215 * for combined 802.11g / 802.11b networks) 222 * number and increasing the sequence number only when the
223 * IEEE80211_TX_CTL_FIRST_FRAGMENT flag is set. mac80211 will properly
224 * assign sequence numbers to QoS-data frames but cannot do so correctly
225 * for non-QoS-data and management frames because beacons need them from
226 * that counter as well and mac80211 cannot guarantee proper sequencing.
227 * If this flag is set, the driver should instruct the hardware to
228 * assign a sequence number to the frame or assign one itself. Cf. IEEE
229 * 802.11-2007 7.1.3.4.1 paragraph 3. This flag will always be set for
230 * beacons and always be clear for frames without a sequence number field.
216 * @IEEE80211_TX_CTL_NO_ACK: tell the low level not to wait for an ack 231 * @IEEE80211_TX_CTL_NO_ACK: tell the low level not to wait for an ack
217 * @IEEE80211_TX_CTL_RATE_CTRL_PROBE: TBD
218 * @IEEE80211_TX_CTL_CLEAR_PS_FILT: clear powersave filter for destination 232 * @IEEE80211_TX_CTL_CLEAR_PS_FILT: clear powersave filter for destination
219 * station 233 * station
220 * @IEEE80211_TX_CTL_REQUEUE: TBD
221 * @IEEE80211_TX_CTL_FIRST_FRAGMENT: this is a first fragment of the frame 234 * @IEEE80211_TX_CTL_FIRST_FRAGMENT: this is a first fragment of the frame
222 * @IEEE80211_TX_CTL_SHORT_PREAMBLE: TBD
223 * @IEEE80211_TX_CTL_LONG_RETRY_LIMIT: this frame should be send using the
224 * through set_retry_limit configured long retry value
225 * @IEEE80211_TX_CTL_SEND_AFTER_DTIM: send this frame after DTIM beacon 235 * @IEEE80211_TX_CTL_SEND_AFTER_DTIM: send this frame after DTIM beacon
226 * @IEEE80211_TX_CTL_AMPDU: this frame should be sent as part of an A-MPDU 236 * @IEEE80211_TX_CTL_AMPDU: this frame should be sent as part of an A-MPDU
227 * @IEEE80211_TX_CTL_OFDM_HT: this frame can be sent in HT OFDM rates. number 237 * @IEEE80211_TX_CTL_INJECTED: Frame was injected, internal to mac80211.
228 * of streams when this flag is on can be extracted from antenna_sel_tx,
229 * so if 1 antenna is marked use SISO, 2 antennas marked use MIMO, n
230 * antennas marked use MIMO_n.
231 * @IEEE80211_TX_CTL_GREEN_FIELD: use green field protection for this frame
232 * @IEEE80211_TX_CTL_40_MHZ_WIDTH: send this frame using 40 Mhz channel width
233 * @IEEE80211_TX_CTL_DUP_DATA: duplicate data frame on both 20 Mhz channels
234 * @IEEE80211_TX_CTL_SHORT_GI: send this frame using short guard interval
235 * @IEEE80211_TX_CTL_INJECTED: TBD
236 * @IEEE80211_TX_STAT_TX_FILTERED: The frame was not transmitted 238 * @IEEE80211_TX_STAT_TX_FILTERED: The frame was not transmitted
237 * because the destination STA was in powersave mode. 239 * because the destination STA was in powersave mode.
238 * @IEEE80211_TX_STAT_ACK: Frame was acknowledged 240 * @IEEE80211_TX_STAT_ACK: Frame was acknowledged
@@ -240,63 +242,67 @@ struct ieee80211_bss_conf {
240 * is for the whole aggregation. 242 * is for the whole aggregation.
241 * @IEEE80211_TX_STAT_AMPDU_NO_BACK: no block ack was returned, 243 * @IEEE80211_TX_STAT_AMPDU_NO_BACK: no block ack was returned,
242 * so consider using block ack request (BAR). 244 * so consider using block ack request (BAR).
243 * @IEEE80211_TX_CTL_ASSIGN_SEQ: The driver has to assign a sequence 245 * @IEEE80211_TX_CTL_RATE_CTRL_PROBE: internal to mac80211, can be
244 * number to this frame, taking care of not overwriting the fragment 246 * set by rate control algorithms to indicate probe rate, will
245 * number and increasing the sequence number only when the 247 * be cleared for fragmented frames (except on the last fragment)
246 * IEEE80211_TX_CTL_FIRST_FRAGMENT flags is set. mac80211 will properly
247 * assign sequence numbers to QoS-data frames but cannot do so correctly
248 * for non-QoS-data and management frames because beacons need them from
249 * that counter as well and mac80211 cannot guarantee proper sequencing.
250 * If this flag is set, the driver should instruct the hardware to
251 * assign a sequence number to the frame or assign one itself. Cf. IEEE
252 * 802.11-2007 7.1.3.4.1 paragraph 3. This flag will always be set for
253 * beacons always be clear for frames without a sequence number field.
254 */ 248 */
255enum mac80211_tx_control_flags { 249enum mac80211_tx_control_flags {
256 IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0), 250 IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0),
257 IEEE80211_TX_CTL_USE_RTS_CTS = BIT(2), 251 IEEE80211_TX_CTL_ASSIGN_SEQ = BIT(1),
258 IEEE80211_TX_CTL_USE_CTS_PROTECT = BIT(3), 252 IEEE80211_TX_CTL_NO_ACK = BIT(2),
259 IEEE80211_TX_CTL_NO_ACK = BIT(4), 253 IEEE80211_TX_CTL_CLEAR_PS_FILT = BIT(3),
260 IEEE80211_TX_CTL_RATE_CTRL_PROBE = BIT(5), 254 IEEE80211_TX_CTL_FIRST_FRAGMENT = BIT(4),
261 IEEE80211_TX_CTL_CLEAR_PS_FILT = BIT(6), 255 IEEE80211_TX_CTL_SEND_AFTER_DTIM = BIT(5),
262 IEEE80211_TX_CTL_REQUEUE = BIT(7), 256 IEEE80211_TX_CTL_AMPDU = BIT(6),
263 IEEE80211_TX_CTL_FIRST_FRAGMENT = BIT(8), 257 IEEE80211_TX_CTL_INJECTED = BIT(7),
264 IEEE80211_TX_CTL_SHORT_PREAMBLE = BIT(9), 258 IEEE80211_TX_STAT_TX_FILTERED = BIT(8),
265 IEEE80211_TX_CTL_LONG_RETRY_LIMIT = BIT(10), 259 IEEE80211_TX_STAT_ACK = BIT(9),
266 IEEE80211_TX_CTL_SEND_AFTER_DTIM = BIT(12), 260 IEEE80211_TX_STAT_AMPDU = BIT(10),
267 IEEE80211_TX_CTL_AMPDU = BIT(13), 261 IEEE80211_TX_STAT_AMPDU_NO_BACK = BIT(11),
268 IEEE80211_TX_CTL_OFDM_HT = BIT(14), 262 IEEE80211_TX_CTL_RATE_CTRL_PROBE = BIT(12),
269 IEEE80211_TX_CTL_GREEN_FIELD = BIT(15), 263};
270 IEEE80211_TX_CTL_40_MHZ_WIDTH = BIT(16), 264
271 IEEE80211_TX_CTL_DUP_DATA = BIT(17), 265enum mac80211_rate_control_flags {
272 IEEE80211_TX_CTL_SHORT_GI = BIT(18), 266 IEEE80211_TX_RC_USE_RTS_CTS = BIT(0),
273 IEEE80211_TX_CTL_INJECTED = BIT(19), 267 IEEE80211_TX_RC_USE_CTS_PROTECT = BIT(1),
274 IEEE80211_TX_STAT_TX_FILTERED = BIT(20), 268 IEEE80211_TX_RC_USE_SHORT_PREAMBLE = BIT(2),
275 IEEE80211_TX_STAT_ACK = BIT(21), 269
276 IEEE80211_TX_STAT_AMPDU = BIT(22), 270 /* rate index is an MCS rate number instead of an index */
277 IEEE80211_TX_STAT_AMPDU_NO_BACK = BIT(23), 271 IEEE80211_TX_RC_MCS = BIT(3),
278 IEEE80211_TX_CTL_ASSIGN_SEQ = BIT(24), 272 IEEE80211_TX_RC_GREEN_FIELD = BIT(4),
273 IEEE80211_TX_RC_40_MHZ_WIDTH = BIT(5),
274 IEEE80211_TX_RC_DUP_DATA = BIT(6),
275 IEEE80211_TX_RC_SHORT_GI = BIT(7),
279}; 276};
280 277
281 278
282#define IEEE80211_TX_INFO_DRIVER_DATA_SIZE \ 279/* there are 40 bytes if you don't need the rateset to be kept */
283 (sizeof(((struct sk_buff *)0)->cb) - 8) 280#define IEEE80211_TX_INFO_DRIVER_DATA_SIZE 40
284#define IEEE80211_TX_INFO_DRIVER_DATA_PTRS \
285 (IEEE80211_TX_INFO_DRIVER_DATA_SIZE / sizeof(void *))
286 281
287/* maximum number of alternate rate retry stages */ 282/* if you do need the rateset, then you have less space */
288#define IEEE80211_TX_MAX_ALTRATE 3 283#define IEEE80211_TX_INFO_RATE_DRIVER_DATA_SIZE 24
284
285/* maximum number of rate stages */
286#define IEEE80211_TX_MAX_RATES 5
289 287
290/** 288/**
291 * struct ieee80211_tx_altrate - alternate rate selection/status 289 * struct ieee80211_tx_rate - rate selection/status
290 *
291 * @idx: rate index to attempt to send with
292 * @flags: rate control flags (&enum mac80211_rate_control_flags)
293 * @count: number of tries in this rate before going to the next rate
292 * 294 *
293 * @rate_idx: rate index to attempt to send with 295 * A value of -1 for @idx indicates an invalid rate and, if used
294 * @limit: number of retries before fallback 296 * in an array of retry rates, that no more rates should be tried.
297 *
298 * When used for transmit status reporting, the driver should
299 * always report the rate along with the flags it used.
295 */ 300 */
296struct ieee80211_tx_altrate { 301struct ieee80211_tx_rate {
297 s8 rate_idx; 302 s8 idx;
298 u8 limit; 303 u8 count;
299}; 304 u8 flags;
305} __attribute__((packed));
300 306
301/** 307/**
302 * struct ieee80211_tx_info - skb transmit information 308 * struct ieee80211_tx_info - skb transmit information
@@ -310,15 +316,13 @@ struct ieee80211_tx_altrate {
310 * it may be NULL. 316 * it may be NULL.
311 * 317 *
312 * @flags: transmit info flags, defined above 318 * @flags: transmit info flags, defined above
313 * @band: TBD 319 * @band: the band to transmit on (use for checking for races)
314 * @tx_rate_idx: TBD 320 * @antenna_sel_tx: antenna to use, 0 for automatic diversity
315 * @antenna_sel_tx: TBD 321 * @pad: padding, ignore
316 * @control: union for control data 322 * @control: union for control data
317 * @status: union for status data 323 * @status: union for status data
318 * @driver_data: array of driver_data pointers 324 * @driver_data: array of driver_data pointers
319 * @retry_count: number of retries 325 * @retry_count: number of retries
320 * @excessive_retries: set to 1 if the frame was retried many times
321 * but not acknowledged
322 * @ampdu_ack_len: number of aggregated frames. 326 * @ampdu_ack_len: number of aggregated frames.
323 * relevant only if IEEE80211_TX_STATUS_AMPDU was set. 327 * relevant only if IEEE80211_TX_STATUS_AMPDU was set.
324 * @ampdu_ack_map: block ack bit map for the aggregation. 328 * @ampdu_ack_map: block ack bit map for the aggregation.
@@ -329,31 +333,44 @@ struct ieee80211_tx_info {
329 /* common information */ 333 /* common information */
330 u32 flags; 334 u32 flags;
331 u8 band; 335 u8 band;
332 s8 tx_rate_idx; 336
333 u8 antenna_sel_tx; 337 u8 antenna_sel_tx;
334 338
335 /* 1 byte hole */ 339 /* 2 byte hole */
340 u8 pad[2];
336 341
337 union { 342 union {
338 struct { 343 struct {
344 union {
345 /* rate control */
346 struct {
347 struct ieee80211_tx_rate rates[
348 IEEE80211_TX_MAX_RATES];
349 s8 rts_cts_rate_idx;
350 };
351 /* only needed before rate control */
352 unsigned long jiffies;
353 };
339 /* NB: vif can be NULL for injected frames */ 354 /* NB: vif can be NULL for injected frames */
340 struct ieee80211_vif *vif; 355 struct ieee80211_vif *vif;
341 struct ieee80211_key_conf *hw_key; 356 struct ieee80211_key_conf *hw_key;
342 struct ieee80211_sta *sta; 357 struct ieee80211_sta *sta;
343 unsigned long jiffies;
344 s8 rts_cts_rate_idx;
345 u8 retry_limit;
346 struct ieee80211_tx_altrate retries[IEEE80211_TX_MAX_ALTRATE];
347 } control; 358 } control;
348 struct { 359 struct {
360 struct ieee80211_tx_rate rates[IEEE80211_TX_MAX_RATES];
361 u8 ampdu_ack_len;
349 u64 ampdu_ack_map; 362 u64 ampdu_ack_map;
350 int ack_signal; 363 int ack_signal;
351 struct ieee80211_tx_altrate retries[IEEE80211_TX_MAX_ALTRATE + 1]; 364 /* 8 bytes free */
352 u8 retry_count;
353 bool excessive_retries;
354 u8 ampdu_ack_len;
355 } status; 365 } status;
356 void *driver_data[IEEE80211_TX_INFO_DRIVER_DATA_PTRS]; 366 struct {
367 struct ieee80211_tx_rate driver_rates[
368 IEEE80211_TX_MAX_RATES];
369 void *rate_driver_data[
370 IEEE80211_TX_INFO_RATE_DRIVER_DATA_SIZE / sizeof(void *)];
371 };
372 void *driver_data[
373 IEEE80211_TX_INFO_DRIVER_DATA_SIZE / sizeof(void *)];
357 }; 374 };
358}; 375};
359 376
@@ -362,6 +379,41 @@ static inline struct ieee80211_tx_info *IEEE80211_SKB_CB(struct sk_buff *skb)
362 return (struct ieee80211_tx_info *)skb->cb; 379 return (struct ieee80211_tx_info *)skb->cb;
363} 380}
364 381
382/**
383 * ieee80211_tx_info_clear_status - clear TX status
384 *
385 * @info: The &struct ieee80211_tx_info to be cleared.
386 *
387 * When the driver passes an skb back to mac80211, it must report
388 * a number of things in TX status. This function clears everything
389 * in the TX status but the rate control information (it does clear
390 * the count since you need to fill that in anyway).
391 *
392 * NOTE: You can only use this function if you do NOT use
393 * info->driver_data! Use info->rate_driver_data
394 * instead if you need only the less space that allows.
395 */
396static inline void
397ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
398{
399 int i;
400
401 BUILD_BUG_ON(offsetof(struct ieee80211_tx_info, status.rates) !=
402 offsetof(struct ieee80211_tx_info, control.rates));
403 BUILD_BUG_ON(offsetof(struct ieee80211_tx_info, status.rates) !=
404 offsetof(struct ieee80211_tx_info, driver_rates));
405 BUILD_BUG_ON(offsetof(struct ieee80211_tx_info, status.rates) != 8);
406 /* clear the rate counts */
407 for (i = 0; i < IEEE80211_TX_MAX_RATES; i++)
408 info->status.rates[i].count = 0;
409
410 BUILD_BUG_ON(
411 offsetof(struct ieee80211_tx_info, status.ampdu_ack_len) != 23);
412 memset(&info->status.ampdu_ack_len, 0,
413 sizeof(struct ieee80211_tx_info) -
414 offsetof(struct ieee80211_tx_info, status.ampdu_ack_len));
415}
416
365 417
366/** 418/**
367 * enum mac80211_rx_flags - receive flags 419 * enum mac80211_rx_flags - receive flags
@@ -384,6 +436,9 @@ static inline struct ieee80211_tx_info *IEEE80211_SKB_CB(struct sk_buff *skb)
384 * is valid. This is useful in monitor mode and necessary for beacon frames 436 * is valid. This is useful in monitor mode and necessary for beacon frames
385 * to enable IBSS merging. 437 * to enable IBSS merging.
386 * @RX_FLAG_SHORTPRE: Short preamble was used for this frame 438 * @RX_FLAG_SHORTPRE: Short preamble was used for this frame
439 * @RX_FLAG_HT: HT MCS was used and rate_idx is MCS index
440 * @RX_FLAG_40MHZ: HT40 (40 MHz) was used
441 * @RX_FLAG_SHORT_GI: Short guard interval was used
387 */ 442 */
388enum mac80211_rx_flags { 443enum mac80211_rx_flags {
389 RX_FLAG_MMIC_ERROR = 1<<0, 444 RX_FLAG_MMIC_ERROR = 1<<0,
@@ -394,7 +449,10 @@ enum mac80211_rx_flags {
394 RX_FLAG_FAILED_FCS_CRC = 1<<5, 449 RX_FLAG_FAILED_FCS_CRC = 1<<5,
395 RX_FLAG_FAILED_PLCP_CRC = 1<<6, 450 RX_FLAG_FAILED_PLCP_CRC = 1<<6,
396 RX_FLAG_TSFT = 1<<7, 451 RX_FLAG_TSFT = 1<<7,
397 RX_FLAG_SHORTPRE = 1<<8 452 RX_FLAG_SHORTPRE = 1<<8,
453 RX_FLAG_HT = 1<<9,
454 RX_FLAG_40MHZ = 1<<10,
455 RX_FLAG_SHORT_GI = 1<<11,
398}; 456};
399 457
400/** 458/**
@@ -414,7 +472,8 @@ enum mac80211_rx_flags {
414 * @noise: noise when receiving this frame, in dBm. 472 * @noise: noise when receiving this frame, in dBm.
415 * @qual: overall signal quality indication, in percent (0-100). 473 * @qual: overall signal quality indication, in percent (0-100).
416 * @antenna: antenna used 474 * @antenna: antenna used
417 * @rate_idx: index of data rate into band's supported rates 475 * @rate_idx: index of data rate into band's supported rates or MCS index if
476 * HT rates are use (RX_FLAG_HT)
418 * @flag: %RX_FLAG_* 477 * @flag: %RX_FLAG_*
419 */ 478 */
420struct ieee80211_rx_status { 479struct ieee80211_rx_status {
@@ -434,21 +493,49 @@ struct ieee80211_rx_status {
434 * 493 *
435 * Flags to define PHY configuration options 494 * Flags to define PHY configuration options
436 * 495 *
437 * @IEEE80211_CONF_SHORT_SLOT_TIME: use 802.11g short slot time
438 * @IEEE80211_CONF_RADIOTAP: add radiotap header at receive time (if supported) 496 * @IEEE80211_CONF_RADIOTAP: add radiotap header at receive time (if supported)
439 * @IEEE80211_CONF_SUPPORT_HT_MODE: use 802.11n HT capabilities (if supported)
440 * @IEEE80211_CONF_PS: Enable 802.11 power save mode 497 * @IEEE80211_CONF_PS: Enable 802.11 power save mode
441 */ 498 */
442enum ieee80211_conf_flags { 499enum ieee80211_conf_flags {
443 /* 500 IEEE80211_CONF_RADIOTAP = (1<<0),
444 * TODO: IEEE80211_CONF_SHORT_SLOT_TIME will be removed once drivers 501 IEEE80211_CONF_PS = (1<<1),
445 * have been converted to use bss_info_changed() for slot time 502};
446 * configuration 503
447 */ 504/* XXX: remove all this once drivers stop trying to use it */
448 IEEE80211_CONF_SHORT_SLOT_TIME = (1<<0), 505static inline int __deprecated __IEEE80211_CONF_SHORT_SLOT_TIME(void)
449 IEEE80211_CONF_RADIOTAP = (1<<1), 506{
450 IEEE80211_CONF_SUPPORT_HT_MODE = (1<<2), 507 return 0;
451 IEEE80211_CONF_PS = (1<<3), 508}
509#define IEEE80211_CONF_SHORT_SLOT_TIME (__IEEE80211_CONF_SHORT_SLOT_TIME())
510
511struct ieee80211_ht_conf {
512 bool enabled;
513 enum nl80211_channel_type channel_type;
514};
515
516/**
517 * enum ieee80211_conf_changed - denotes which configuration changed
518 *
519 * @IEEE80211_CONF_CHANGE_RADIO_ENABLED: the value of radio_enabled changed
520 * @IEEE80211_CONF_CHANGE_BEACON_INTERVAL: the beacon interval changed
521 * @IEEE80211_CONF_CHANGE_LISTEN_INTERVAL: the listen interval changed
522 * @IEEE80211_CONF_CHANGE_RADIOTAP: the radiotap flag changed
523 * @IEEE80211_CONF_CHANGE_PS: the PS flag changed
524 * @IEEE80211_CONF_CHANGE_POWER: the TX power changed
525 * @IEEE80211_CONF_CHANGE_CHANNEL: the channel changed
526 * @IEEE80211_CONF_CHANGE_RETRY_LIMITS: retry limits changed
527 * @IEEE80211_CONF_CHANGE_HT: HT configuration changed
528 */
529enum ieee80211_conf_changed {
530 IEEE80211_CONF_CHANGE_RADIO_ENABLED = BIT(0),
531 IEEE80211_CONF_CHANGE_BEACON_INTERVAL = BIT(1),
532 IEEE80211_CONF_CHANGE_LISTEN_INTERVAL = BIT(2),
533 IEEE80211_CONF_CHANGE_RADIOTAP = BIT(3),
534 IEEE80211_CONF_CHANGE_PS = BIT(4),
535 IEEE80211_CONF_CHANGE_POWER = BIT(5),
536 IEEE80211_CONF_CHANGE_CHANNEL = BIT(6),
537 IEEE80211_CONF_CHANGE_RETRY_LIMITS = BIT(7),
538 IEEE80211_CONF_CHANGE_HT = BIT(8),
452}; 539};
453 540
454/** 541/**
@@ -457,34 +544,31 @@ enum ieee80211_conf_flags {
457 * This struct indicates how the driver shall configure the hardware. 544 * This struct indicates how the driver shall configure the hardware.
458 * 545 *
459 * @radio_enabled: when zero, driver is required to switch off the radio. 546 * @radio_enabled: when zero, driver is required to switch off the radio.
460 * TODO make a flag
461 * @beacon_int: beacon interval (TODO make interface config) 547 * @beacon_int: beacon interval (TODO make interface config)
462 * @listen_interval: listen interval in units of beacon interval 548 * @listen_interval: listen interval in units of beacon interval
463 * @flags: configuration flags defined above 549 * @flags: configuration flags defined above
464 * @power_level: requested transmit power (in dBm) 550 * @power_level: requested transmit power (in dBm)
465 * @max_antenna_gain: maximum antenna gain (in dBi)
466 * @antenna_sel_tx: transmit antenna selection, 0: default/diversity,
467 * 1/2: antenna 0/1
468 * @antenna_sel_rx: receive antenna selection, like @antenna_sel_tx
469 * @ht_conf: describes current self configuration of 802.11n HT capabilies
470 * @ht_bss_conf: describes current BSS configuration of 802.11n HT parameters
471 * @channel: the channel to tune to 551 * @channel: the channel to tune to
552 * @ht: the HT configuration for the device
553 * @long_frame_max_tx_count: Maximum number of transmissions for a "long" frame
554 * (a frame not RTS protected), called "dot11LongRetryLimit" in 802.11,
555 * but actually means the number of transmissions not the number of retries
556 * @short_frame_max_tx_count: Maximum number of transmissions for a "short"
557 * frame, called "dot11ShortRetryLimit" in 802.11, but actually means the
558 * number of transmissions not the number of retries
472 */ 559 */
473struct ieee80211_conf { 560struct ieee80211_conf {
474 int radio_enabled;
475
476 int beacon_int; 561 int beacon_int;
477 u16 listen_interval;
478 u32 flags; 562 u32 flags;
479 int power_level; 563 int power_level;
480 int max_antenna_gain;
481 u8 antenna_sel_tx;
482 u8 antenna_sel_rx;
483 564
484 struct ieee80211_channel *channel; 565 u16 listen_interval;
566 bool radio_enabled;
567
568 u8 long_frame_max_tx_count, short_frame_max_tx_count;
485 569
486 struct ieee80211_ht_info ht_conf; 570 struct ieee80211_channel *channel;
487 struct ieee80211_ht_bss_info ht_bss_conf; 571 struct ieee80211_ht_conf ht;
488}; 572};
489 573
490/** 574/**
@@ -494,11 +578,14 @@ struct ieee80211_conf {
494 * use during the life of a virtual interface. 578 * use during the life of a virtual interface.
495 * 579 *
496 * @type: type of this virtual interface 580 * @type: type of this virtual interface
581 * @bss_conf: BSS configuration for this interface, either our own
582 * or the BSS we're associated to
497 * @drv_priv: data area for driver use, will always be aligned to 583 * @drv_priv: data area for driver use, will always be aligned to
498 * sizeof(void *). 584 * sizeof(void *).
499 */ 585 */
500struct ieee80211_vif { 586struct ieee80211_vif {
501 enum nl80211_iftype type; 587 enum nl80211_iftype type;
588 struct ieee80211_bss_conf bss_conf;
502 /* must be last */ 589 /* must be last */
503 u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *)))); 590 u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *))));
504}; 591};
@@ -542,14 +629,12 @@ struct ieee80211_if_init_conf {
542 * enum ieee80211_if_conf_change - interface config change flags 629 * enum ieee80211_if_conf_change - interface config change flags
543 * 630 *
544 * @IEEE80211_IFCC_BSSID: The BSSID changed. 631 * @IEEE80211_IFCC_BSSID: The BSSID changed.
545 * @IEEE80211_IFCC_SSID: The SSID changed.
546 * @IEEE80211_IFCC_BEACON: The beacon for this interface changed 632 * @IEEE80211_IFCC_BEACON: The beacon for this interface changed
547 * (currently AP and MESH only), use ieee80211_beacon_get(). 633 * (currently AP and MESH only), use ieee80211_beacon_get().
548 */ 634 */
549enum ieee80211_if_conf_change { 635enum ieee80211_if_conf_change {
550 IEEE80211_IFCC_BSSID = BIT(0), 636 IEEE80211_IFCC_BSSID = BIT(0),
551 IEEE80211_IFCC_SSID = BIT(1), 637 IEEE80211_IFCC_BEACON = BIT(1),
552 IEEE80211_IFCC_BEACON = BIT(2),
553}; 638};
554 639
555/** 640/**
@@ -557,11 +642,6 @@ enum ieee80211_if_conf_change {
557 * 642 *
558 * @changed: parameters that have changed, see &enum ieee80211_if_conf_change. 643 * @changed: parameters that have changed, see &enum ieee80211_if_conf_change.
559 * @bssid: BSSID of the network we are associated to/creating. 644 * @bssid: BSSID of the network we are associated to/creating.
560 * @ssid: used (together with @ssid_len) by drivers for hardware that
561 * generate beacons independently. The pointer is valid only during the
562 * config_interface() call, so copy the value somewhere if you need
563 * it.
564 * @ssid_len: length of the @ssid field.
565 * 645 *
566 * This structure is passed to the config_interface() callback of 646 * This structure is passed to the config_interface() callback of
567 * &struct ieee80211_hw. 647 * &struct ieee80211_hw.
@@ -569,8 +649,6 @@ enum ieee80211_if_conf_change {
569struct ieee80211_if_conf { 649struct ieee80211_if_conf {
570 u32 changed; 650 u32 changed;
571 u8 *bssid; 651 u8 *bssid;
572 u8 *ssid;
573 size_t ssid_len;
574}; 652};
575 653
576/** 654/**
@@ -677,7 +755,7 @@ enum set_key_cmd {
677 * @addr: MAC address 755 * @addr: MAC address
678 * @aid: AID we assigned to the station if we're an AP 756 * @aid: AID we assigned to the station if we're an AP
679 * @supp_rates: Bitmap of supported rates (per band) 757 * @supp_rates: Bitmap of supported rates (per band)
680 * @ht_info: HT capabilities of this STA 758 * @ht_cap: HT capabilities of this STA; restricted to our own TX capabilities
681 * @drv_priv: data area for driver use, will always be aligned to 759 * @drv_priv: data area for driver use, will always be aligned to
682 * sizeof(void *), size is determined in hw information. 760 * sizeof(void *), size is determined in hw information.
683 */ 761 */
@@ -685,7 +763,7 @@ struct ieee80211_sta {
685 u64 supp_rates[IEEE80211_NUM_BANDS]; 763 u64 supp_rates[IEEE80211_NUM_BANDS];
686 u8 addr[ETH_ALEN]; 764 u8 addr[ETH_ALEN];
687 u16 aid; 765 u16 aid;
688 struct ieee80211_ht_info ht_info; 766 struct ieee80211_sta_ht_cap ht_cap;
689 767
690 /* must be last */ 768 /* must be last */
691 u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *)))); 769 u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *))));
@@ -695,13 +773,17 @@ struct ieee80211_sta {
695 * enum sta_notify_cmd - sta notify command 773 * enum sta_notify_cmd - sta notify command
696 * 774 *
697 * Used with the sta_notify() callback in &struct ieee80211_ops, this 775 * Used with the sta_notify() callback in &struct ieee80211_ops, this
698 * indicates addition and removal of a station to station table. 776 * indicates addition and removal of a station to station table,
777 * or if a associated station made a power state transition.
699 * 778 *
700 * @STA_NOTIFY_ADD: a station was added to the station table 779 * @STA_NOTIFY_ADD: a station was added to the station table
701 * @STA_NOTIFY_REMOVE: a station being removed from the station table 780 * @STA_NOTIFY_REMOVE: a station being removed from the station table
781 * @STA_NOTIFY_SLEEP: a station is now sleeping
782 * @STA_NOTIFY_AWAKE: a sleeping station woke up
702 */ 783 */
703enum sta_notify_cmd { 784enum sta_notify_cmd {
704 STA_NOTIFY_ADD, STA_NOTIFY_REMOVE 785 STA_NOTIFY_ADD, STA_NOTIFY_REMOVE,
786 STA_NOTIFY_SLEEP, STA_NOTIFY_AWAKE,
705}; 787};
706 788
707/** 789/**
@@ -769,6 +851,14 @@ enum ieee80211_tkip_key_type {
769 * @IEEE80211_HW_SPECTRUM_MGMT: 851 * @IEEE80211_HW_SPECTRUM_MGMT:
770 * Hardware supports spectrum management defined in 802.11h 852 * Hardware supports spectrum management defined in 802.11h
771 * Measurement, Channel Switch, Quieting, TPC 853 * Measurement, Channel Switch, Quieting, TPC
854 *
855 * @IEEE80211_HW_AMPDU_AGGREGATION:
856 * Hardware supports 11n A-MPDU aggregation.
857 *
858 * @IEEE80211_HW_NO_STACK_DYNAMIC_PS:
859 * Hardware which has dynamic power save support, meaning
860 * that power save is enabled in idle periods, and don't need support
861 * from stack.
772 */ 862 */
773enum ieee80211_hw_flags { 863enum ieee80211_hw_flags {
774 IEEE80211_HW_RX_INCLUDES_FCS = 1<<1, 864 IEEE80211_HW_RX_INCLUDES_FCS = 1<<1,
@@ -780,6 +870,8 @@ enum ieee80211_hw_flags {
780 IEEE80211_HW_SIGNAL_DBM = 1<<7, 870 IEEE80211_HW_SIGNAL_DBM = 1<<7,
781 IEEE80211_HW_NOISE_DBM = 1<<8, 871 IEEE80211_HW_NOISE_DBM = 1<<8,
782 IEEE80211_HW_SPECTRUM_MGMT = 1<<9, 872 IEEE80211_HW_SPECTRUM_MGMT = 1<<9,
873 IEEE80211_HW_AMPDU_AGGREGATION = 1<<10,
874 IEEE80211_HW_NO_STACK_DYNAMIC_PS = 1<<11,
783}; 875};
784 876
785/** 877/**
@@ -838,8 +930,8 @@ enum ieee80211_hw_flags {
838 * @sta_data_size: size (in bytes) of the drv_priv data area 930 * @sta_data_size: size (in bytes) of the drv_priv data area
839 * within &struct ieee80211_sta. 931 * within &struct ieee80211_sta.
840 * 932 *
841 * @max_altrates: maximum number of alternate rate retry stages 933 * @max_rates: maximum number of alternate rate retry stages
842 * @max_altrate_tries: maximum number of tries for each stage 934 * @max_rate_tries: maximum number of tries for each stage
843 */ 935 */
844struct ieee80211_hw { 936struct ieee80211_hw {
845 struct ieee80211_conf conf; 937 struct ieee80211_conf conf;
@@ -856,12 +948,10 @@ struct ieee80211_hw {
856 u16 ampdu_queues; 948 u16 ampdu_queues;
857 u16 max_listen_interval; 949 u16 max_listen_interval;
858 s8 max_signal; 950 s8 max_signal;
859 u8 max_altrates; 951 u8 max_rates;
860 u8 max_altrate_tries; 952 u8 max_rate_tries;
861}; 953};
862 954
863struct ieee80211_hw *wiphy_to_hw(struct wiphy *wiphy);
864
865/** 955/**
866 * SET_IEEE80211_DEV - set device for 802.11 hardware 956 * SET_IEEE80211_DEV - set device for 802.11 hardware
867 * 957 *
@@ -874,7 +964,7 @@ static inline void SET_IEEE80211_DEV(struct ieee80211_hw *hw, struct device *dev
874} 964}
875 965
876/** 966/**
877 * SET_IEEE80211_PERM_ADDR - set the permanenet MAC address for 802.11 hardware 967 * SET_IEEE80211_PERM_ADDR - set the permanent MAC address for 802.11 hardware
878 * 968 *
879 * @hw: the &struct ieee80211_hw to set the MAC address for 969 * @hw: the &struct ieee80211_hw to set the MAC address for
880 * @addr: the address to set 970 * @addr: the address to set
@@ -898,9 +988,9 @@ static inline struct ieee80211_rate *
898ieee80211_get_tx_rate(const struct ieee80211_hw *hw, 988ieee80211_get_tx_rate(const struct ieee80211_hw *hw,
899 const struct ieee80211_tx_info *c) 989 const struct ieee80211_tx_info *c)
900{ 990{
901 if (WARN_ON(c->tx_rate_idx < 0)) 991 if (WARN_ON(c->control.rates[0].idx < 0))
902 return NULL; 992 return NULL;
903 return &hw->wiphy->bands[c->band]->bitrates[c->tx_rate_idx]; 993 return &hw->wiphy->bands[c->band]->bitrates[c->control.rates[0].idx];
904} 994}
905 995
906static inline struct ieee80211_rate * 996static inline struct ieee80211_rate *
@@ -916,9 +1006,9 @@ static inline struct ieee80211_rate *
916ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw, 1006ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
917 const struct ieee80211_tx_info *c, int idx) 1007 const struct ieee80211_tx_info *c, int idx)
918{ 1008{
919 if (c->control.retries[idx].rate_idx < 0) 1009 if (c->control.rates[idx + 1].idx < 0)
920 return NULL; 1010 return NULL;
921 return &hw->wiphy->bands[c->band]->bitrates[c->control.retries[idx].rate_idx]; 1011 return &hw->wiphy->bands[c->band]->bitrates[c->control.rates[idx + 1].idx];
922} 1012}
923 1013
924/** 1014/**
@@ -967,7 +1057,7 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
967 * This happens everytime the iv16 wraps around (every 65536 packets). The 1057 * This happens everytime the iv16 wraps around (every 65536 packets). The
968 * set_key() call will happen only once for each key (unless the AP did 1058 * set_key() call will happen only once for each key (unless the AP did
969 * rekeying), it will not include a valid phase 1 key. The valid phase 1 key is 1059 * rekeying), it will not include a valid phase 1 key. The valid phase 1 key is
970 * provided by udpate_tkip_key only. The trigger that makes mac80211 call this 1060 * provided by update_tkip_key only. The trigger that makes mac80211 call this
971 * handler is software decryption with wrap around of iv16. 1061 * handler is software decryption with wrap around of iv16.
972 */ 1062 */
973 1063
@@ -1060,12 +1150,14 @@ enum ieee80211_filter_flags {
1060 * @IEEE80211_AMPDU_RX_STOP: stop Rx aggregation 1150 * @IEEE80211_AMPDU_RX_STOP: stop Rx aggregation
1061 * @IEEE80211_AMPDU_TX_START: start Tx aggregation 1151 * @IEEE80211_AMPDU_TX_START: start Tx aggregation
1062 * @IEEE80211_AMPDU_TX_STOP: stop Tx aggregation 1152 * @IEEE80211_AMPDU_TX_STOP: stop Tx aggregation
1153 * @IEEE80211_AMPDU_TX_RESUME: resume TX aggregation
1063 */ 1154 */
1064enum ieee80211_ampdu_mlme_action { 1155enum ieee80211_ampdu_mlme_action {
1065 IEEE80211_AMPDU_RX_START, 1156 IEEE80211_AMPDU_RX_START,
1066 IEEE80211_AMPDU_RX_STOP, 1157 IEEE80211_AMPDU_RX_STOP,
1067 IEEE80211_AMPDU_TX_START, 1158 IEEE80211_AMPDU_TX_START,
1068 IEEE80211_AMPDU_TX_STOP, 1159 IEEE80211_AMPDU_TX_STOP,
1160 IEEE80211_AMPDU_TX_RESUME,
1069}; 1161};
1070 1162
1071/** 1163/**
@@ -1101,7 +1193,7 @@ enum ieee80211_ampdu_mlme_action {
1101 * Must be implemented. 1193 * Must be implemented.
1102 * 1194 *
1103 * @add_interface: Called when a netdevice attached to the hardware is 1195 * @add_interface: Called when a netdevice attached to the hardware is
1104 * enabled. Because it is not called for monitor mode devices, @open 1196 * enabled. Because it is not called for monitor mode devices, @start
1105 * and @stop must be implemented. 1197 * and @stop must be implemented.
1106 * The driver should perform any initialization it needs before 1198 * The driver should perform any initialization it needs before
1107 * the device can be enabled. The initial configuration for the 1199 * the device can be enabled. The initial configuration for the
@@ -1163,14 +1255,9 @@ enum ieee80211_ampdu_mlme_action {
1163 * 1255 *
1164 * @set_rts_threshold: Configuration of RTS threshold (if device needs it) 1256 * @set_rts_threshold: Configuration of RTS threshold (if device needs it)
1165 * 1257 *
1166 * @set_frag_threshold: Configuration of fragmentation threshold. Assign this if 1258 * @sta_notify: Notifies low level driver about addition, removal or power
1167 * the device does fragmentation by itself; if this method is assigned then 1259 * state transition of an associated station, AP, IBSS/WDS/mesh peer etc.
1168 * the stack will not do fragmentation. 1260 * Must be atomic.
1169 *
1170 * @set_retry_limit: Configuration of retry limits (if device needs it)
1171 *
1172 * @sta_notify: Notifies low level driver about addition or removal
1173 * of assocaited station or AP.
1174 * 1261 *
1175 * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max), 1262 * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max),
1176 * bursting) for a hardware TX queue. 1263 * bursting) for a hardware TX queue.
@@ -1194,8 +1281,6 @@ enum ieee80211_ampdu_mlme_action {
1194 * This is needed only for IBSS mode and the result of this function is 1281 * This is needed only for IBSS mode and the result of this function is
1195 * used to determine whether to reply to Probe Requests. 1282 * used to determine whether to reply to Probe Requests.
1196 * 1283 *
1197 * @conf_ht: Configures low level driver with 802.11n HT data. Must be atomic.
1198 *
1199 * @ampdu_action: Perform a certain A-MPDU action 1284 * @ampdu_action: Perform a certain A-MPDU action
1200 * The RA/TID combination determines the destination and TID we want 1285 * The RA/TID combination determines the destination and TID we want
1201 * the ampdu action to be performed for. The action is defined through 1286 * the ampdu action to be performed for. The action is defined through
@@ -1211,7 +1296,7 @@ struct ieee80211_ops {
1211 struct ieee80211_if_init_conf *conf); 1296 struct ieee80211_if_init_conf *conf);
1212 void (*remove_interface)(struct ieee80211_hw *hw, 1297 void (*remove_interface)(struct ieee80211_hw *hw,
1213 struct ieee80211_if_init_conf *conf); 1298 struct ieee80211_if_init_conf *conf);
1214 int (*config)(struct ieee80211_hw *hw, struct ieee80211_conf *conf); 1299 int (*config)(struct ieee80211_hw *hw, u32 changed);
1215 int (*config_interface)(struct ieee80211_hw *hw, 1300 int (*config_interface)(struct ieee80211_hw *hw,
1216 struct ieee80211_vif *vif, 1301 struct ieee80211_vif *vif,
1217 struct ieee80211_if_conf *conf); 1302 struct ieee80211_if_conf *conf);
@@ -1237,9 +1322,6 @@ struct ieee80211_ops {
1237 void (*get_tkip_seq)(struct ieee80211_hw *hw, u8 hw_key_idx, 1322 void (*get_tkip_seq)(struct ieee80211_hw *hw, u8 hw_key_idx,
1238 u32 *iv32, u16 *iv16); 1323 u32 *iv32, u16 *iv16);
1239 int (*set_rts_threshold)(struct ieee80211_hw *hw, u32 value); 1324 int (*set_rts_threshold)(struct ieee80211_hw *hw, u32 value);
1240 int (*set_frag_threshold)(struct ieee80211_hw *hw, u32 value);
1241 int (*set_retry_limit)(struct ieee80211_hw *hw,
1242 u32 short_retry, u32 long_retr);
1243 void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 1325 void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1244 enum sta_notify_cmd, struct ieee80211_sta *sta); 1326 enum sta_notify_cmd, struct ieee80211_sta *sta);
1245 int (*conf_tx)(struct ieee80211_hw *hw, u16 queue, 1327 int (*conf_tx)(struct ieee80211_hw *hw, u16 queue,
@@ -1472,7 +1554,7 @@ void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw,
1472 * the next beacon frame from the 802.11 code. The low-level is responsible 1554 * the next beacon frame from the 802.11 code. The low-level is responsible
1473 * for calling this function before beacon data is needed (e.g., based on 1555 * for calling this function before beacon data is needed (e.g., based on
1474 * hardware interrupt). Returned skb is used only once and low-level driver 1556 * hardware interrupt). Returned skb is used only once and low-level driver
1475 * is responsible of freeing it. 1557 * is responsible for freeing it.
1476 */ 1558 */
1477struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, 1559struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,
1478 struct ieee80211_vif *vif); 1560 struct ieee80211_vif *vif);
@@ -1803,24 +1885,38 @@ struct ieee80211_sta *ieee80211_find_sta(struct ieee80211_hw *hw,
1803 1885
1804 1886
1805/* Rate control API */ 1887/* Rate control API */
1888
1806/** 1889/**
1807 * struct rate_selection - rate information for/from rate control algorithms 1890 * struct ieee80211_tx_rate_control - rate control information for/from RC algo
1808 * 1891 *
1809 * @rate_idx: selected transmission rate index 1892 * @hw: The hardware the algorithm is invoked for.
1810 * @nonerp_idx: Non-ERP rate to use instead if ERP cannot be used 1893 * @sband: The band this frame is being transmitted on.
1811 * @probe_idx: rate for probing (or -1) 1894 * @bss_conf: the current BSS configuration
1812 * @max_rate_idx: maximum rate index that can be used, this is 1895 * @reported_rate: The rate control algorithm can fill this in to indicate
1813 * input to the algorithm and will be enforced 1896 * which rate should be reported to userspace as the current rate and
1814 */ 1897 * used for rate calculations in the mesh network.
1815struct rate_selection { 1898 * @rts: whether RTS will be used for this frame because it is longer than the
1816 s8 rate_idx, nonerp_idx, probe_idx, max_rate_idx; 1899 * RTS threshold
1900 * @short_preamble: whether mac80211 will request short-preamble transmission
1901 * if the selected rate supports it
1902 * @max_rate_idx: user-requested maximum rate (not MCS for now)
1903 * @skb: the skb that will be transmitted, the control information in it needs
1904 * to be filled in
1905 */
1906struct ieee80211_tx_rate_control {
1907 struct ieee80211_hw *hw;
1908 struct ieee80211_supported_band *sband;
1909 struct ieee80211_bss_conf *bss_conf;
1910 struct sk_buff *skb;
1911 struct ieee80211_tx_rate reported_rate;
1912 bool rts, short_preamble;
1913 u8 max_rate_idx;
1817}; 1914};
1818 1915
1819struct rate_control_ops { 1916struct rate_control_ops {
1820 struct module *module; 1917 struct module *module;
1821 const char *name; 1918 const char *name;
1822 void *(*alloc)(struct ieee80211_hw *hw, struct dentry *debugfsdir); 1919 void *(*alloc)(struct ieee80211_hw *hw, struct dentry *debugfsdir);
1823 void (*clear)(void *priv);
1824 void (*free)(void *priv); 1920 void (*free)(void *priv);
1825 1921
1826 void *(*alloc_sta)(void *priv, struct ieee80211_sta *sta, gfp_t gfp); 1922 void *(*alloc_sta)(void *priv, struct ieee80211_sta *sta, gfp_t gfp);
@@ -1832,10 +1928,8 @@ struct rate_control_ops {
1832 void (*tx_status)(void *priv, struct ieee80211_supported_band *sband, 1928 void (*tx_status)(void *priv, struct ieee80211_supported_band *sband,
1833 struct ieee80211_sta *sta, void *priv_sta, 1929 struct ieee80211_sta *sta, void *priv_sta,
1834 struct sk_buff *skb); 1930 struct sk_buff *skb);
1835 void (*get_rate)(void *priv, struct ieee80211_supported_band *sband, 1931 void (*get_rate)(void *priv, struct ieee80211_sta *sta, void *priv_sta,
1836 struct ieee80211_sta *sta, void *priv_sta, 1932 struct ieee80211_tx_rate_control *txrc);
1837 struct sk_buff *skb,
1838 struct rate_selection *sel);
1839 1933
1840 void (*add_sta_debugfs)(void *priv, void *priv_sta, 1934 void (*add_sta_debugfs)(void *priv, void *priv_sta,
1841 struct dentry *dir); 1935 struct dentry *dir);
diff --git a/include/net/ndisc.h b/include/net/ndisc.h
index 11dd0137c6a..ce532f2222c 100644
--- a/include/net/ndisc.h
+++ b/include/net/ndisc.h
@@ -108,6 +108,20 @@ extern void ndisc_send_redirect(struct sk_buff *skb,
108 108
109extern int ndisc_mc_map(struct in6_addr *addr, char *buf, struct net_device *dev, int dir); 109extern int ndisc_mc_map(struct in6_addr *addr, char *buf, struct net_device *dev, int dir);
110 110
111extern struct sk_buff *ndisc_build_skb(struct net_device *dev,
112 const struct in6_addr *daddr,
113 const struct in6_addr *saddr,
114 struct icmp6hdr *icmp6h,
115 const struct in6_addr *target,
116 int llinfo);
117
118extern void ndisc_send_skb(struct sk_buff *skb,
119 struct net_device *dev,
120 struct neighbour *neigh,
121 const struct in6_addr *daddr,
122 const struct in6_addr *saddr,
123 struct icmp6hdr *icmp6h);
124
111 125
112 126
113/* 127/*
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index aa4b708654a..d8d790e56d3 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -180,9 +180,6 @@ struct neigh_table
180 __u32 hash_rnd; 180 __u32 hash_rnd;
181 unsigned int hash_chain_gc; 181 unsigned int hash_chain_gc;
182 struct pneigh_entry **phash_buckets; 182 struct pneigh_entry **phash_buckets;
183#ifdef CONFIG_PROC_FS
184 struct proc_dir_entry *pde;
185#endif
186}; 183};
187 184
188/* flags for neigh_update() */ 185/* flags for neigh_update() */
@@ -223,11 +220,7 @@ extern void neigh_parms_release(struct neigh_table *tbl, struct neigh_parms *p
223static inline 220static inline
224struct net *neigh_parms_net(const struct neigh_parms *parms) 221struct net *neigh_parms_net(const struct neigh_parms *parms)
225{ 222{
226#ifdef CONFIG_NET_NS 223 return read_pnet(&parms->net);
227 return parms->net;
228#else
229 return &init_net;
230#endif
231} 224}
232 225
233extern unsigned long neigh_rand_reach_time(unsigned long base); 226extern unsigned long neigh_rand_reach_time(unsigned long base);
@@ -244,11 +237,7 @@ extern int pneigh_delete(struct neigh_table *tbl, struct net *net, const void
244static inline 237static inline
245struct net *pneigh_net(const struct pneigh_entry *pneigh) 238struct net *pneigh_net(const struct pneigh_entry *pneigh)
246{ 239{
247#ifdef CONFIG_NET_NS 240 return read_pnet(&pneigh->net);
248 return pneigh->net;
249#else
250 return &init_net;
251#endif
252} 241}
253 242
254extern void neigh_app_ns(struct neighbour *n); 243extern void neigh_app_ns(struct neighbour *n);
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index 700c53a3c6f..6fc13d905c5 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -19,6 +19,7 @@
19#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 19#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
20#include <net/netns/conntrack.h> 20#include <net/netns/conntrack.h>
21#endif 21#endif
22#include <net/netns/xfrm.h>
22 23
23struct proc_dir_entry; 24struct proc_dir_entry;
24struct net_device; 25struct net_device;
@@ -74,6 +75,9 @@ struct net {
74 struct netns_ct ct; 75 struct netns_ct ct;
75#endif 76#endif
76#endif 77#endif
78#ifdef CONFIG_XFRM
79 struct netns_xfrm xfrm;
80#endif
77 struct net_generic *gen; 81 struct net_generic *gen;
78}; 82};
79 83
@@ -192,6 +196,24 @@ static inline void release_net(struct net *net)
192} 196}
193#endif 197#endif
194 198
199#ifdef CONFIG_NET_NS
200
201static inline void write_pnet(struct net **pnet, struct net *net)
202{
203 *pnet = net;
204}
205
206static inline struct net *read_pnet(struct net * const *pnet)
207{
208 return *pnet;
209}
210
211#else
212
213#define write_pnet(pnet, net) do { (void)(net);} while (0)
214#define read_pnet(pnet) (&init_net)
215
216#endif
195 217
196#define for_each_net(VAR) \ 218#define for_each_net(VAR) \
197 list_for_each_entry(VAR, &net_namespace_list, list) 219 list_for_each_entry(VAR, &net_namespace_list, list)
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index b76a8685b5b..2e0c53641cb 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -199,7 +199,7 @@ __nf_conntrack_find(struct net *net, const struct nf_conntrack_tuple *tuple);
199 199
200extern void nf_conntrack_hash_insert(struct nf_conn *ct); 200extern void nf_conntrack_hash_insert(struct nf_conn *ct);
201 201
202extern void nf_conntrack_flush(struct net *net); 202extern void nf_conntrack_flush(struct net *net, u32 pid, int report);
203 203
204extern bool nf_ct_get_tuplepr(const struct sk_buff *skb, 204extern bool nf_ct_get_tuplepr(const struct sk_buff *skb,
205 unsigned int nhoff, u_int16_t l3num, 205 unsigned int nhoff, u_int16_t l3num,
@@ -298,5 +298,8 @@ do { \
298 local_bh_enable(); \ 298 local_bh_enable(); \
299} while (0) 299} while (0)
300 300
301#define MODULE_ALIAS_NFCT_HELPER(helper) \
302 MODULE_ALIAS("nfct-helper-" helper)
303
301#endif /* __KERNEL__ */ 304#endif /* __KERNEL__ */
302#endif /* _NF_CONNTRACK_H */ 305#endif /* _NF_CONNTRACK_H */
diff --git a/include/net/netfilter/nf_conntrack_ecache.h b/include/net/netfilter/nf_conntrack_ecache.h
index 1285ff26a01..0ff0dc69ca4 100644
--- a/include/net/netfilter/nf_conntrack_ecache.h
+++ b/include/net/netfilter/nf_conntrack_ecache.h
@@ -17,6 +17,13 @@ struct nf_conntrack_ecache {
17 unsigned int events; 17 unsigned int events;
18}; 18};
19 19
20/* This structure is passed to event handler */
21struct nf_ct_event {
22 struct nf_conn *ct;
23 u32 pid;
24 int report;
25};
26
20extern struct atomic_notifier_head nf_conntrack_chain; 27extern struct atomic_notifier_head nf_conntrack_chain;
21extern int nf_conntrack_register_notifier(struct notifier_block *nb); 28extern int nf_conntrack_register_notifier(struct notifier_block *nb);
22extern int nf_conntrack_unregister_notifier(struct notifier_block *nb); 29extern int nf_conntrack_unregister_notifier(struct notifier_block *nb);
@@ -39,22 +46,56 @@ nf_conntrack_event_cache(enum ip_conntrack_events event, struct nf_conn *ct)
39 local_bh_enable(); 46 local_bh_enable();
40} 47}
41 48
42static inline void nf_conntrack_event(enum ip_conntrack_events event, 49static inline void
43 struct nf_conn *ct) 50nf_conntrack_event_report(enum ip_conntrack_events event,
51 struct nf_conn *ct,
52 u32 pid,
53 int report)
44{ 54{
55 struct nf_ct_event item = {
56 .ct = ct,
57 .pid = pid,
58 .report = report
59 };
45 if (nf_ct_is_confirmed(ct) && !nf_ct_is_dying(ct)) 60 if (nf_ct_is_confirmed(ct) && !nf_ct_is_dying(ct))
46 atomic_notifier_call_chain(&nf_conntrack_chain, event, ct); 61 atomic_notifier_call_chain(&nf_conntrack_chain, event, &item);
47} 62}
48 63
64static inline void
65nf_conntrack_event(enum ip_conntrack_events event, struct nf_conn *ct)
66{
67 nf_conntrack_event_report(event, ct, 0, 0);
68}
69
70struct nf_exp_event {
71 struct nf_conntrack_expect *exp;
72 u32 pid;
73 int report;
74};
75
49extern struct atomic_notifier_head nf_ct_expect_chain; 76extern struct atomic_notifier_head nf_ct_expect_chain;
50extern int nf_ct_expect_register_notifier(struct notifier_block *nb); 77extern int nf_ct_expect_register_notifier(struct notifier_block *nb);
51extern int nf_ct_expect_unregister_notifier(struct notifier_block *nb); 78extern int nf_ct_expect_unregister_notifier(struct notifier_block *nb);
52 79
53static inline void 80static inline void
81nf_ct_expect_event_report(enum ip_conntrack_expect_events event,
82 struct nf_conntrack_expect *exp,
83 u32 pid,
84 int report)
85{
86 struct nf_exp_event item = {
87 .exp = exp,
88 .pid = pid,
89 .report = report
90 };
91 atomic_notifier_call_chain(&nf_ct_expect_chain, event, &item);
92}
93
94static inline void
54nf_ct_expect_event(enum ip_conntrack_expect_events event, 95nf_ct_expect_event(enum ip_conntrack_expect_events event,
55 struct nf_conntrack_expect *exp) 96 struct nf_conntrack_expect *exp)
56{ 97{
57 atomic_notifier_call_chain(&nf_ct_expect_chain, event, exp); 98 nf_ct_expect_event_report(event, exp, 0, 0);
58} 99}
59 100
60extern int nf_conntrack_ecache_init(struct net *net); 101extern int nf_conntrack_ecache_init(struct net *net);
@@ -66,9 +107,17 @@ static inline void nf_conntrack_event_cache(enum ip_conntrack_events event,
66 struct nf_conn *ct) {} 107 struct nf_conn *ct) {}
67static inline void nf_conntrack_event(enum ip_conntrack_events event, 108static inline void nf_conntrack_event(enum ip_conntrack_events event,
68 struct nf_conn *ct) {} 109 struct nf_conn *ct) {}
110static inline void nf_conntrack_event_report(enum ip_conntrack_events event,
111 struct nf_conn *ct,
112 u32 pid,
113 int report) {}
69static inline void nf_ct_deliver_cached_events(const struct nf_conn *ct) {} 114static inline void nf_ct_deliver_cached_events(const struct nf_conn *ct) {}
70static inline void nf_ct_expect_event(enum ip_conntrack_expect_events event, 115static inline void nf_ct_expect_event(enum ip_conntrack_expect_events event,
71 struct nf_conntrack_expect *exp) {} 116 struct nf_conntrack_expect *exp) {}
117static inline void nf_ct_expect_event_report(enum ip_conntrack_expect_events e,
118 struct nf_conntrack_expect *exp,
119 u32 pid,
120 int report) {}
72static inline void nf_ct_event_cache_flush(struct net *net) {} 121static inline void nf_ct_event_cache_flush(struct net *net) {}
73 122
74static inline int nf_conntrack_ecache_init(struct net *net) 123static inline int nf_conntrack_ecache_init(struct net *net)
diff --git a/include/net/netfilter/nf_conntrack_expect.h b/include/net/netfilter/nf_conntrack_expect.h
index 37a7fc1164b..ab17a159ac6 100644
--- a/include/net/netfilter/nf_conntrack_expect.h
+++ b/include/net/netfilter/nf_conntrack_expect.h
@@ -100,6 +100,8 @@ void nf_ct_expect_init(struct nf_conntrack_expect *, unsigned int, u_int8_t,
100 u_int8_t, const __be16 *, const __be16 *); 100 u_int8_t, const __be16 *, const __be16 *);
101void nf_ct_expect_put(struct nf_conntrack_expect *exp); 101void nf_ct_expect_put(struct nf_conntrack_expect *exp);
102int nf_ct_expect_related(struct nf_conntrack_expect *expect); 102int nf_ct_expect_related(struct nf_conntrack_expect *expect);
103int nf_ct_expect_related_report(struct nf_conntrack_expect *expect,
104 u32 pid, int report);
103 105
104#endif /*_NF_CONNTRACK_EXPECT_H*/ 106#endif /*_NF_CONNTRACK_EXPECT_H*/
105 107
diff --git a/include/net/netfilter/nf_conntrack_helper.h b/include/net/netfilter/nf_conntrack_helper.h
index f8060ab5a08..66d65a7caa3 100644
--- a/include/net/netfilter/nf_conntrack_helper.h
+++ b/include/net/netfilter/nf_conntrack_helper.h
@@ -39,9 +39,6 @@ struct nf_conntrack_helper
39}; 39};
40 40
41extern struct nf_conntrack_helper * 41extern struct nf_conntrack_helper *
42__nf_ct_helper_find(const struct nf_conntrack_tuple *tuple);
43
44extern struct nf_conntrack_helper *
45__nf_conntrack_helper_find_byname(const char *name); 42__nf_conntrack_helper_find_byname(const char *name);
46 43
47extern int nf_conntrack_helper_register(struct nf_conntrack_helper *); 44extern int nf_conntrack_helper_register(struct nf_conntrack_helper *);
@@ -49,6 +46,8 @@ extern void nf_conntrack_helper_unregister(struct nf_conntrack_helper *);
49 46
50extern struct nf_conn_help *nf_ct_helper_ext_add(struct nf_conn *ct, gfp_t gfp); 47extern struct nf_conn_help *nf_ct_helper_ext_add(struct nf_conn *ct, gfp_t gfp);
51 48
49extern int __nf_ct_try_assign_helper(struct nf_conn *ct, gfp_t flags);
50
52static inline struct nf_conn_help *nfct_help(const struct nf_conn *ct) 51static inline struct nf_conn_help *nfct_help(const struct nf_conn *ct)
53{ 52{
54 return nf_ct_ext_find(ct, NF_CT_EXT_HELPER); 53 return nf_ct_ext_find(ct, NF_CT_EXT_HELPER);
diff --git a/include/net/netfilter/nf_conntrack_l4proto.h b/include/net/netfilter/nf_conntrack_l4proto.h
index 7f2f43c7728..debdaf75cec 100644
--- a/include/net/netfilter/nf_conntrack_l4proto.h
+++ b/include/net/netfilter/nf_conntrack_l4proto.h
@@ -129,7 +129,7 @@ extern const struct nla_policy nf_ct_port_nla_policy[];
129 && net_ratelimit()) 129 && net_ratelimit())
130#endif 130#endif
131#else 131#else
132#define LOG_INVALID(net, proto) 0 132static inline int LOG_INVALID(struct net *net, int proto) { return 0; }
133#endif /* CONFIG_SYSCTL */ 133#endif /* CONFIG_SYSCTL */
134 134
135#endif /*_NF_CONNTRACK_PROTOCOL_H*/ 135#endif /*_NF_CONNTRACK_PROTOCOL_H*/
diff --git a/include/net/netfilter/nf_conntrack_tuple.h b/include/net/netfilter/nf_conntrack_tuple.h
index a6874ba22d5..f2f6aa73dc1 100644
--- a/include/net/netfilter/nf_conntrack_tuple.h
+++ b/include/net/netfilter/nf_conntrack_tuple.h
@@ -112,20 +112,20 @@ struct nf_conntrack_tuple_mask
112static inline void nf_ct_dump_tuple_ip(const struct nf_conntrack_tuple *t) 112static inline void nf_ct_dump_tuple_ip(const struct nf_conntrack_tuple *t)
113{ 113{
114#ifdef DEBUG 114#ifdef DEBUG
115 printk("tuple %p: %u " NIPQUAD_FMT ":%hu -> " NIPQUAD_FMT ":%hu\n", 115 printk("tuple %p: %u %pI4:%hu -> %pI4:%hu\n",
116 t, t->dst.protonum, 116 t, t->dst.protonum,
117 NIPQUAD(t->src.u3.ip), ntohs(t->src.u.all), 117 &t->src.u3.ip, ntohs(t->src.u.all),
118 NIPQUAD(t->dst.u3.ip), ntohs(t->dst.u.all)); 118 &t->dst.u3.ip, ntohs(t->dst.u.all));
119#endif 119#endif
120} 120}
121 121
122static inline void nf_ct_dump_tuple_ipv6(const struct nf_conntrack_tuple *t) 122static inline void nf_ct_dump_tuple_ipv6(const struct nf_conntrack_tuple *t)
123{ 123{
124#ifdef DEBUG 124#ifdef DEBUG
125 printk("tuple %p: %u " NIP6_FMT " %hu -> " NIP6_FMT " %hu\n", 125 printk("tuple %p: %u %pI6 %hu -> %pI6 %hu\n",
126 t, t->dst.protonum, 126 t, t->dst.protonum,
127 NIP6(*(struct in6_addr *)t->src.u3.all), ntohs(t->src.u.all), 127 t->src.u3.all, ntohs(t->src.u.all),
128 NIP6(*(struct in6_addr *)t->dst.u3.all), ntohs(t->dst.u.all)); 128 t->dst.u3.all, ntohs(t->dst.u.all));
129#endif 129#endif
130} 130}
131 131
diff --git a/include/net/netfilter/nfnetlink_log.h b/include/net/netfilter/nfnetlink_log.h
new file mode 100644
index 00000000000..b0569ff0775
--- /dev/null
+++ b/include/net/netfilter/nfnetlink_log.h
@@ -0,0 +1,14 @@
1#ifndef _KER_NFNETLINK_LOG_H
2#define _KER_NFNETLINK_LOG_H
3
4void
5nfulnl_log_packet(u_int8_t pf,
6 unsigned int hooknum,
7 const struct sk_buff *skb,
8 const struct net_device *in,
9 const struct net_device *out,
10 const struct nf_loginfo *li_user,
11 const char *prefix);
12
13#endif /* _KER_NFNETLINK_LOG_H */
14
diff --git a/include/net/netlink.h b/include/net/netlink.h
index 3643bbb8e58..8a6150a3f4c 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -233,7 +233,7 @@ extern int nla_parse(struct nlattr *tb[], int maxtype,
233extern struct nlattr * nla_find(struct nlattr *head, int len, int attrtype); 233extern struct nlattr * nla_find(struct nlattr *head, int len, int attrtype);
234extern size_t nla_strlcpy(char *dst, const struct nlattr *nla, 234extern size_t nla_strlcpy(char *dst, const struct nlattr *nla,
235 size_t dstsize); 235 size_t dstsize);
236extern int nla_memcpy(void *dest, struct nlattr *src, int count); 236extern int nla_memcpy(void *dest, const struct nlattr *src, int count);
237extern int nla_memcmp(const struct nlattr *nla, const void *data, 237extern int nla_memcmp(const struct nlattr *nla, const void *data,
238 size_t size); 238 size_t size);
239extern int nla_strcmp(const struct nlattr *nla, const char *str); 239extern int nla_strcmp(const struct nlattr *nla, const char *str);
@@ -332,7 +332,7 @@ static inline int nlmsg_attrlen(const struct nlmsghdr *nlh, int hdrlen)
332 */ 332 */
333static inline int nlmsg_ok(const struct nlmsghdr *nlh, int remaining) 333static inline int nlmsg_ok(const struct nlmsghdr *nlh, int remaining)
334{ 334{
335 return (remaining >= sizeof(struct nlmsghdr) && 335 return (remaining >= (int) sizeof(struct nlmsghdr) &&
336 nlh->nlmsg_len >= sizeof(struct nlmsghdr) && 336 nlh->nlmsg_len >= sizeof(struct nlmsghdr) &&
337 nlh->nlmsg_len <= remaining); 337 nlh->nlmsg_len <= remaining);
338} 338}
@@ -741,7 +741,7 @@ static inline struct nlattr *nla_find_nested(struct nlattr *nla, int attrtype)
741 * See nla_parse() 741 * See nla_parse()
742 */ 742 */
743static inline int nla_parse_nested(struct nlattr *tb[], int maxtype, 743static inline int nla_parse_nested(struct nlattr *tb[], int maxtype,
744 struct nlattr *nla, 744 const struct nlattr *nla,
745 const struct nla_policy *policy) 745 const struct nla_policy *policy)
746{ 746{
747 return nla_parse(tb, maxtype, nla_data(nla), nla_len(nla), policy); 747 return nla_parse(tb, maxtype, nla_data(nla), nla_len(nla), policy);
@@ -875,7 +875,7 @@ static inline int nla_put_msecs(struct sk_buff *skb, int attrtype,
875 * nla_get_u32 - return payload of u32 attribute 875 * nla_get_u32 - return payload of u32 attribute
876 * @nla: u32 netlink attribute 876 * @nla: u32 netlink attribute
877 */ 877 */
878static inline u32 nla_get_u32(struct nlattr *nla) 878static inline u32 nla_get_u32(const struct nlattr *nla)
879{ 879{
880 return *(u32 *) nla_data(nla); 880 return *(u32 *) nla_data(nla);
881} 881}
@@ -884,7 +884,7 @@ static inline u32 nla_get_u32(struct nlattr *nla)
884 * nla_get_be32 - return payload of __be32 attribute 884 * nla_get_be32 - return payload of __be32 attribute
885 * @nla: __be32 netlink attribute 885 * @nla: __be32 netlink attribute
886 */ 886 */
887static inline __be32 nla_get_be32(struct nlattr *nla) 887static inline __be32 nla_get_be32(const struct nlattr *nla)
888{ 888{
889 return *(__be32 *) nla_data(nla); 889 return *(__be32 *) nla_data(nla);
890} 890}
@@ -893,7 +893,7 @@ static inline __be32 nla_get_be32(struct nlattr *nla)
893 * nla_get_u16 - return payload of u16 attribute 893 * nla_get_u16 - return payload of u16 attribute
894 * @nla: u16 netlink attribute 894 * @nla: u16 netlink attribute
895 */ 895 */
896static inline u16 nla_get_u16(struct nlattr *nla) 896static inline u16 nla_get_u16(const struct nlattr *nla)
897{ 897{
898 return *(u16 *) nla_data(nla); 898 return *(u16 *) nla_data(nla);
899} 899}
@@ -902,7 +902,7 @@ static inline u16 nla_get_u16(struct nlattr *nla)
902 * nla_get_be16 - return payload of __be16 attribute 902 * nla_get_be16 - return payload of __be16 attribute
903 * @nla: __be16 netlink attribute 903 * @nla: __be16 netlink attribute
904 */ 904 */
905static inline __be16 nla_get_be16(struct nlattr *nla) 905static inline __be16 nla_get_be16(const struct nlattr *nla)
906{ 906{
907 return *(__be16 *) nla_data(nla); 907 return *(__be16 *) nla_data(nla);
908} 908}
@@ -911,7 +911,7 @@ static inline __be16 nla_get_be16(struct nlattr *nla)
911 * nla_get_le16 - return payload of __le16 attribute 911 * nla_get_le16 - return payload of __le16 attribute
912 * @nla: __le16 netlink attribute 912 * @nla: __le16 netlink attribute
913 */ 913 */
914static inline __le16 nla_get_le16(struct nlattr *nla) 914static inline __le16 nla_get_le16(const struct nlattr *nla)
915{ 915{
916 return *(__le16 *) nla_data(nla); 916 return *(__le16 *) nla_data(nla);
917} 917}
@@ -920,7 +920,7 @@ static inline __le16 nla_get_le16(struct nlattr *nla)
920 * nla_get_u8 - return payload of u8 attribute 920 * nla_get_u8 - return payload of u8 attribute
921 * @nla: u8 netlink attribute 921 * @nla: u8 netlink attribute
922 */ 922 */
923static inline u8 nla_get_u8(struct nlattr *nla) 923static inline u8 nla_get_u8(const struct nlattr *nla)
924{ 924{
925 return *(u8 *) nla_data(nla); 925 return *(u8 *) nla_data(nla);
926} 926}
@@ -929,7 +929,7 @@ static inline u8 nla_get_u8(struct nlattr *nla)
929 * nla_get_u64 - return payload of u64 attribute 929 * nla_get_u64 - return payload of u64 attribute
930 * @nla: u64 netlink attribute 930 * @nla: u64 netlink attribute
931 */ 931 */
932static inline u64 nla_get_u64(struct nlattr *nla) 932static inline u64 nla_get_u64(const struct nlattr *nla)
933{ 933{
934 u64 tmp; 934 u64 tmp;
935 935
@@ -942,7 +942,7 @@ static inline u64 nla_get_u64(struct nlattr *nla)
942 * nla_get_flag - return payload of flag attribute 942 * nla_get_flag - return payload of flag attribute
943 * @nla: flag netlink attribute 943 * @nla: flag netlink attribute
944 */ 944 */
945static inline int nla_get_flag(struct nlattr *nla) 945static inline int nla_get_flag(const struct nlattr *nla)
946{ 946{
947 return !!nla; 947 return !!nla;
948} 948}
@@ -953,7 +953,7 @@ static inline int nla_get_flag(struct nlattr *nla)
953 * 953 *
954 * Returns the number of milliseconds in jiffies. 954 * Returns the number of milliseconds in jiffies.
955 */ 955 */
956static inline unsigned long nla_get_msecs(struct nlattr *nla) 956static inline unsigned long nla_get_msecs(const struct nlattr *nla)
957{ 957{
958 u64 msecs = nla_get_u64(nla); 958 u64 msecs = nla_get_u64(nla);
959 959
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h
index ece1c926b5d..977f482d97a 100644
--- a/include/net/netns/ipv4.h
+++ b/include/net/netns/ipv4.h
@@ -49,6 +49,8 @@ struct netns_ipv4 {
49 int sysctl_icmp_ratelimit; 49 int sysctl_icmp_ratelimit;
50 int sysctl_icmp_ratemask; 50 int sysctl_icmp_ratemask;
51 int sysctl_icmp_errors_use_inbound_ifaddr; 51 int sysctl_icmp_errors_use_inbound_ifaddr;
52 int sysctl_rt_cache_rebuild_count;
53 int current_rt_cache_rebuild_count;
52 54
53 struct timer_list rt_secret_timer; 55 struct timer_list rt_secret_timer;
54 atomic_t rt_genid; 56 atomic_t rt_genid;
diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h
index 2932721180c..afab4e4cbac 100644
--- a/include/net/netns/ipv6.h
+++ b/include/net/netns/ipv6.h
@@ -55,5 +55,17 @@ struct netns_ipv6 {
55 struct sock *ndisc_sk; 55 struct sock *ndisc_sk;
56 struct sock *tcp_sk; 56 struct sock *tcp_sk;
57 struct sock *igmp_sk; 57 struct sock *igmp_sk;
58#ifdef CONFIG_IPV6_MROUTE
59 struct sock *mroute6_sk;
60 struct mfc6_cache **mfc6_cache_array;
61 struct mif_device *vif6_table;
62 int maxvif;
63 atomic_t cache_resolve_queue_len;
64 int mroute_do_assert;
65 int mroute_do_pim;
66#ifdef CONFIG_IPV6_PIMSM_V2
67 int mroute_reg_vif_num;
68#endif
69#endif
58}; 70};
59#endif 71#endif
diff --git a/include/net/netns/mib.h b/include/net/netns/mib.h
index 10cb7c336de..0b44112e236 100644
--- a/include/net/netns/mib.h
+++ b/include/net/netns/mib.h
@@ -20,6 +20,9 @@ struct netns_mib {
20 DEFINE_SNMP_STAT(struct icmpv6_mib, icmpv6_statistics); 20 DEFINE_SNMP_STAT(struct icmpv6_mib, icmpv6_statistics);
21 DEFINE_SNMP_STAT(struct icmpv6msg_mib, icmpv6msg_statistics); 21 DEFINE_SNMP_STAT(struct icmpv6msg_mib, icmpv6msg_statistics);
22#endif 22#endif
23#ifdef CONFIG_XFRM_STATISTICS
24 DEFINE_SNMP_STAT(struct linux_xfrm_mib, xfrm_statistics);
25#endif
23}; 26};
24 27
25#endif 28#endif
diff --git a/include/net/netns/x_tables.h b/include/net/netns/x_tables.h
index b8093971ccb..9554a644a8f 100644
--- a/include/net/netns/x_tables.h
+++ b/include/net/netns/x_tables.h
@@ -4,7 +4,12 @@
4#include <linux/list.h> 4#include <linux/list.h>
5#include <linux/netfilter.h> 5#include <linux/netfilter.h>
6 6
7struct ebt_table;
8
7struct netns_xt { 9struct netns_xt {
8 struct list_head tables[NFPROTO_NUMPROTO]; 10 struct list_head tables[NFPROTO_NUMPROTO];
11 struct ebt_table *broute_table;
12 struct ebt_table *frame_filter;
13 struct ebt_table *frame_nat;
9}; 14};
10#endif 15#endif
diff --git a/include/net/netns/xfrm.h b/include/net/netns/xfrm.h
new file mode 100644
index 00000000000..1ba912749ca
--- /dev/null
+++ b/include/net/netns/xfrm.h
@@ -0,0 +1,56 @@
1#ifndef __NETNS_XFRM_H
2#define __NETNS_XFRM_H
3
4#include <linux/list.h>
5#include <linux/wait.h>
6#include <linux/workqueue.h>
7#include <linux/xfrm.h>
8
9struct ctl_table_header;
10
11struct xfrm_policy_hash {
12 struct hlist_head *table;
13 unsigned int hmask;
14};
15
16struct netns_xfrm {
17 struct list_head state_all;
18 /*
19 * Hash table to find appropriate SA towards given target (endpoint of
20 * tunnel or destination of transport mode) allowed by selector.
21 *
22 * Main use is finding SA after policy selected tunnel or transport
23 * mode. Also, it can be used by ah/esp icmp error handler to find
24 * offending SA.
25 */
26 struct hlist_head *state_bydst;
27 struct hlist_head *state_bysrc;
28 struct hlist_head *state_byspi;
29 unsigned int state_hmask;
30 unsigned int state_num;
31 struct work_struct state_hash_work;
32 struct hlist_head state_gc_list;
33 struct work_struct state_gc_work;
34
35 wait_queue_head_t km_waitq;
36
37 struct list_head policy_all;
38 struct hlist_head *policy_byidx;
39 unsigned int policy_idx_hmask;
40 struct hlist_head policy_inexact[XFRM_POLICY_MAX * 2];
41 struct xfrm_policy_hash policy_bydst[XFRM_POLICY_MAX * 2];
42 unsigned int policy_count[XFRM_POLICY_MAX * 2];
43 struct work_struct policy_hash_work;
44
45 struct sock *nlsk;
46
47 u32 sysctl_aevent_etime;
48 u32 sysctl_aevent_rseqth;
49 int sysctl_larval_drop;
50 u32 sysctl_acq_expires;
51#ifdef CONFIG_SYSCTL
52 struct ctl_table_header *sysctl_hdr;
53#endif
54};
55
56#endif
diff --git a/include/net/phonet/pep.h b/include/net/phonet/pep.h
index fcd793030e4..4c61cdce4e5 100644
--- a/include/net/phonet/pep.h
+++ b/include/net/phonet/pep.h
@@ -35,12 +35,12 @@ struct pep_sock {
35 struct sock *listener; 35 struct sock *listener;
36 struct sk_buff_head ctrlreq_queue; 36 struct sk_buff_head ctrlreq_queue;
37#define PNPIPE_CTRLREQ_MAX 10 37#define PNPIPE_CTRLREQ_MAX 10
38 atomic_t tx_credits;
38 int ifindex; 39 int ifindex;
39 u16 peer_type; /* peer type/subtype */ 40 u16 peer_type; /* peer type/subtype */
40 u8 pipe_handle; 41 u8 pipe_handle;
41 42
42 u8 rx_credits; 43 u8 rx_credits;
43 u8 tx_credits;
44 u8 rx_fc; /* RX flow control */ 44 u8 rx_fc; /* RX flow control */
45 u8 tx_fc; /* TX flow control */ 45 u8 tx_fc; /* TX flow control */
46 u8 init_enable; /* auto-enable at creation */ 46 u8 init_enable; /* auto-enable at creation */
diff --git a/include/net/phonet/phonet.h b/include/net/phonet/phonet.h
index c6a24518446..057b0a8a288 100644
--- a/include/net/phonet/phonet.h
+++ b/include/net/phonet/phonet.h
@@ -46,7 +46,7 @@ static inline struct pn_sock *pn_sk(struct sock *sk)
46 46
47extern const struct proto_ops phonet_dgram_ops; 47extern const struct proto_ops phonet_dgram_ops;
48 48
49struct sock *pn_find_sock_by_sa(const struct sockaddr_pn *sa); 49struct sock *pn_find_sock_by_sa(struct net *net, const struct sockaddr_pn *sa);
50void phonet_get_local_port_range(int *min, int *max); 50void phonet_get_local_port_range(int *min, int *max);
51void pn_sock_hash(struct sock *sk); 51void pn_sock_hash(struct sock *sk);
52void pn_sock_unhash(struct sock *sk); 52void pn_sock_unhash(struct sock *sk);
diff --git a/include/net/phonet/pn_dev.h b/include/net/phonet/pn_dev.h
index bbd2a836e04..aa1c59a1d33 100644
--- a/include/net/phonet/pn_dev.h
+++ b/include/net/phonet/pn_dev.h
@@ -43,7 +43,7 @@ struct net_device *phonet_device_get(struct net *net);
43int phonet_address_add(struct net_device *dev, u8 addr); 43int phonet_address_add(struct net_device *dev, u8 addr);
44int phonet_address_del(struct net_device *dev, u8 addr); 44int phonet_address_del(struct net_device *dev, u8 addr);
45u8 phonet_address_get(struct net_device *dev, u8 addr); 45u8 phonet_address_get(struct net_device *dev, u8 addr);
46int phonet_address_lookup(u8 addr); 46int phonet_address_lookup(struct net *net, u8 addr);
47 47
48#define PN_NO_ADDR 0xff 48#define PN_NO_ADDR 0xff
49 49
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h
index aa9e282db48..d1ca3144464 100644
--- a/include/net/pkt_cls.h
+++ b/include/net/pkt_cls.h
@@ -246,7 +246,7 @@ struct tcf_ematch_ops
246}; 246};
247 247
248extern int tcf_em_register(struct tcf_ematch_ops *); 248extern int tcf_em_register(struct tcf_ematch_ops *);
249extern int tcf_em_unregister(struct tcf_ematch_ops *); 249extern void tcf_em_unregister(struct tcf_ematch_ops *);
250extern int tcf_em_tree_validate(struct tcf_proto *, struct nlattr *, 250extern int tcf_em_tree_validate(struct tcf_proto *, struct nlattr *,
251 struct tcf_ematch_tree *); 251 struct tcf_ematch_tree *);
252extern void tcf_em_tree_destroy(struct tcf_proto *, struct tcf_ematch_tree *); 252extern void tcf_em_tree_destroy(struct tcf_proto *, struct tcf_ematch_tree *);
diff --git a/include/net/protocol.h b/include/net/protocol.h
index 8d024d7cb74..cb2965aa1b6 100644
--- a/include/net/protocol.h
+++ b/include/net/protocol.h
@@ -39,6 +39,9 @@ struct net_protocol {
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 int features);
42 struct sk_buff **(*gro_receive)(struct sk_buff **head,
43 struct sk_buff *skb);
44 int (*gro_complete)(struct sk_buff *skb);
42 unsigned int no_policy:1, 45 unsigned int no_policy:1,
43 netns_ok:1; 46 netns_ok:1;
44}; 47};
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 3fe49d80895..f8c47429044 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -53,7 +53,6 @@ struct Qdisc
53 atomic_t refcnt; 53 atomic_t refcnt;
54 unsigned long state; 54 unsigned long state;
55 struct sk_buff *gso_skb; 55 struct sk_buff *gso_skb;
56 struct sk_buff_head requeue;
57 struct sk_buff_head q; 56 struct sk_buff_head q;
58 struct netdev_queue *dev_queue; 57 struct netdev_queue *dev_queue;
59 struct Qdisc *next_sched; 58 struct Qdisc *next_sched;
@@ -111,7 +110,7 @@ struct Qdisc_ops
111 110
112 int (*enqueue)(struct sk_buff *, struct Qdisc *); 111 int (*enqueue)(struct sk_buff *, struct Qdisc *);
113 struct sk_buff * (*dequeue)(struct Qdisc *); 112 struct sk_buff * (*dequeue)(struct Qdisc *);
114 int (*requeue)(struct sk_buff *, struct Qdisc *); 113 struct sk_buff * (*peek)(struct Qdisc *);
115 unsigned int (*drop)(struct Qdisc *); 114 unsigned int (*drop)(struct Qdisc *);
116 115
117 int (*init)(struct Qdisc *, struct nlattr *arg); 116 int (*init)(struct Qdisc *, struct nlattr *arg);
@@ -432,19 +431,38 @@ static inline struct sk_buff *qdisc_dequeue_tail(struct Qdisc *sch)
432 return __qdisc_dequeue_tail(sch, &sch->q); 431 return __qdisc_dequeue_tail(sch, &sch->q);
433} 432}
434 433
435static inline int __qdisc_requeue(struct sk_buff *skb, struct Qdisc *sch, 434static inline struct sk_buff *qdisc_peek_head(struct Qdisc *sch)
436 struct sk_buff_head *list)
437{ 435{
438 __skb_queue_head(list, skb); 436 return skb_peek(&sch->q);
439 sch->qstats.backlog += qdisc_pkt_len(skb); 437}
440 sch->qstats.requeues++;
441 438
442 return NET_XMIT_SUCCESS; 439/* generic pseudo peek method for non-work-conserving qdisc */
440static inline struct sk_buff *qdisc_peek_dequeued(struct Qdisc *sch)
441{
442 /* we can reuse ->gso_skb because peek isn't called for root qdiscs */
443 if (!sch->gso_skb) {
444 sch->gso_skb = sch->dequeue(sch);
445 if (sch->gso_skb)
446 /* it's still part of the queue */
447 sch->q.qlen++;
448 }
449
450 return sch->gso_skb;
443} 451}
444 452
445static inline int qdisc_requeue(struct sk_buff *skb, struct Qdisc *sch) 453/* use instead of qdisc->dequeue() for all qdiscs queried with ->peek() */
454static inline struct sk_buff *qdisc_dequeue_peeked(struct Qdisc *sch)
446{ 455{
447 return __qdisc_requeue(skb, sch, &sch->q); 456 struct sk_buff *skb = sch->gso_skb;
457
458 if (skb) {
459 sch->gso_skb = NULL;
460 sch->q.qlen--;
461 } else {
462 skb = sch->dequeue(sch);
463 }
464
465 return skb;
448} 466}
449 467
450static inline void __qdisc_reset_queue(struct Qdisc *sch, 468static inline void __qdisc_reset_queue(struct Qdisc *sch,
diff --git a/include/net/scm.h b/include/net/scm.h
index 33e9986beb8..f45bb6eca7d 100644
--- a/include/net/scm.h
+++ b/include/net/scm.h
@@ -55,8 +55,8 @@ static __inline__ int scm_send(struct socket *sock, struct msghdr *msg,
55 struct scm_cookie *scm) 55 struct scm_cookie *scm)
56{ 56{
57 struct task_struct *p = current; 57 struct task_struct *p = current;
58 scm->creds.uid = p->uid; 58 scm->creds.uid = current_uid();
59 scm->creds.gid = p->gid; 59 scm->creds.gid = current_gid();
60 scm->creds.pid = task_tgid_vnr(p); 60 scm->creds.pid = task_tgid_vnr(p);
61 scm->fp = NULL; 61 scm->fp = NULL;
62 scm->seq = 0; 62 scm->seq = 0;
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index ed71b110edf..bbb7742195b 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -138,6 +138,7 @@ void sctp_write_space(struct sock *sk);
138unsigned int sctp_poll(struct file *file, struct socket *sock, 138unsigned int sctp_poll(struct file *file, struct socket *sock,
139 poll_table *wait); 139 poll_table *wait);
140void sctp_sock_rfree(struct sk_buff *skb); 140void sctp_sock_rfree(struct sk_buff *skb);
141extern struct percpu_counter sctp_sockets_allocated;
141 142
142/* 143/*
143 * sctp/primitive.c 144 * sctp/primitive.c
@@ -285,15 +286,15 @@ extern int sctp_debug_flag;
285 if (sctp_debug_flag) { \ 286 if (sctp_debug_flag) { \
286 if (saddr->sa.sa_family == AF_INET6) { \ 287 if (saddr->sa.sa_family == AF_INET6) { \
287 printk(KERN_DEBUG \ 288 printk(KERN_DEBUG \
288 lead NIP6_FMT trail, \ 289 lead "%pI6" trail, \
289 leadparm, \ 290 leadparm, \
290 NIP6(saddr->v6.sin6_addr), \ 291 &saddr->v6.sin6_addr, \
291 otherparms); \ 292 otherparms); \
292 } else { \ 293 } else { \
293 printk(KERN_DEBUG \ 294 printk(KERN_DEBUG \
294 lead NIPQUAD_FMT trail, \ 295 lead "%pI4" trail, \
295 leadparm, \ 296 leadparm, \
296 NIPQUAD(saddr->v4.sin_addr.s_addr), \ 297 &saddr->v4.sin_addr.s_addr, \
297 otherparms); \ 298 otherparms); \
298 } \ 299 } \
299 } 300 }
diff --git a/include/net/sctp/user.h b/include/net/sctp/user.h
index f205b10f0ab..b259fc5798f 100644
--- a/include/net/sctp/user.h
+++ b/include/net/sctp/user.h
@@ -118,6 +118,8 @@ enum sctp_optname {
118#define SCTP_PEER_AUTH_CHUNKS SCTP_PEER_AUTH_CHUNKS 118#define SCTP_PEER_AUTH_CHUNKS SCTP_PEER_AUTH_CHUNKS
119 SCTP_LOCAL_AUTH_CHUNKS, /* Read only */ 119 SCTP_LOCAL_AUTH_CHUNKS, /* Read only */
120#define SCTP_LOCAL_AUTH_CHUNKS SCTP_LOCAL_AUTH_CHUNKS 120#define SCTP_LOCAL_AUTH_CHUNKS SCTP_LOCAL_AUTH_CHUNKS
121 SCTP_GET_ASSOC_NUMBER, /* Read only */
122#define SCTP_GET_ASSOC_NUMBER SCTP_GET_ASSOC_NUMBER
121 123
122 124
123 /* Internal Socket Options. Some of the sctp library functions are 125 /* Internal Socket Options. Some of the sctp library functions are
diff --git a/include/net/sock.h b/include/net/sock.h
index 2f47107f6d0..5a3a151bd73 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -42,6 +42,7 @@
42 42
43#include <linux/kernel.h> 43#include <linux/kernel.h>
44#include <linux/list.h> 44#include <linux/list.h>
45#include <linux/list_nulls.h>
45#include <linux/timer.h> 46#include <linux/timer.h>
46#include <linux/cache.h> 47#include <linux/cache.h>
47#include <linux/module.h> 48#include <linux/module.h>
@@ -52,6 +53,7 @@
52#include <linux/security.h> 53#include <linux/security.h>
53 54
54#include <linux/filter.h> 55#include <linux/filter.h>
56#include <linux/rculist_nulls.h>
55 57
56#include <asm/atomic.h> 58#include <asm/atomic.h>
57#include <net/dst.h> 59#include <net/dst.h>
@@ -106,6 +108,7 @@ struct net;
106 * @skc_reuse: %SO_REUSEADDR setting 108 * @skc_reuse: %SO_REUSEADDR setting
107 * @skc_bound_dev_if: bound device index if != 0 109 * @skc_bound_dev_if: bound device index if != 0
108 * @skc_node: main hash linkage for various protocol lookup tables 110 * @skc_node: main hash linkage for various protocol lookup tables
111 * @skc_nulls_node: main hash linkage for UDP/UDP-Lite protocol
109 * @skc_bind_node: bind hash linkage for various protocol lookup tables 112 * @skc_bind_node: bind hash linkage for various protocol lookup tables
110 * @skc_refcnt: reference count 113 * @skc_refcnt: reference count
111 * @skc_hash: hash value used with various protocol lookup tables 114 * @skc_hash: hash value used with various protocol lookup tables
@@ -120,7 +123,10 @@ struct sock_common {
120 volatile unsigned char skc_state; 123 volatile unsigned char skc_state;
121 unsigned char skc_reuse; 124 unsigned char skc_reuse;
122 int skc_bound_dev_if; 125 int skc_bound_dev_if;
123 struct hlist_node skc_node; 126 union {
127 struct hlist_node skc_node;
128 struct hlist_nulls_node skc_nulls_node;
129 };
124 struct hlist_node skc_bind_node; 130 struct hlist_node skc_bind_node;
125 atomic_t skc_refcnt; 131 atomic_t skc_refcnt;
126 unsigned int skc_hash; 132 unsigned int skc_hash;
@@ -206,6 +212,7 @@ struct sock {
206#define sk_reuse __sk_common.skc_reuse 212#define sk_reuse __sk_common.skc_reuse
207#define sk_bound_dev_if __sk_common.skc_bound_dev_if 213#define sk_bound_dev_if __sk_common.skc_bound_dev_if
208#define sk_node __sk_common.skc_node 214#define sk_node __sk_common.skc_node
215#define sk_nulls_node __sk_common.skc_nulls_node
209#define sk_bind_node __sk_common.skc_bind_node 216#define sk_bind_node __sk_common.skc_bind_node
210#define sk_refcnt __sk_common.skc_refcnt 217#define sk_refcnt __sk_common.skc_refcnt
211#define sk_hash __sk_common.skc_hash 218#define sk_hash __sk_common.skc_hash
@@ -229,7 +236,9 @@ struct sock {
229 } sk_backlog; 236 } sk_backlog;
230 wait_queue_head_t *sk_sleep; 237 wait_queue_head_t *sk_sleep;
231 struct dst_entry *sk_dst_cache; 238 struct dst_entry *sk_dst_cache;
239#ifdef CONFIG_XFRM
232 struct xfrm_policy *sk_policy[2]; 240 struct xfrm_policy *sk_policy[2];
241#endif
233 rwlock_t sk_dst_lock; 242 rwlock_t sk_dst_lock;
234 atomic_t sk_rmem_alloc; 243 atomic_t sk_rmem_alloc;
235 atomic_t sk_wmem_alloc; 244 atomic_t sk_wmem_alloc;
@@ -237,7 +246,9 @@ struct sock {
237 int sk_sndbuf; 246 int sk_sndbuf;
238 struct sk_buff_head sk_receive_queue; 247 struct sk_buff_head sk_receive_queue;
239 struct sk_buff_head sk_write_queue; 248 struct sk_buff_head sk_write_queue;
249#ifdef CONFIG_NET_DMA
240 struct sk_buff_head sk_async_wait_queue; 250 struct sk_buff_head sk_async_wait_queue;
251#endif
241 int sk_wmem_queued; 252 int sk_wmem_queued;
242 int sk_forward_alloc; 253 int sk_forward_alloc;
243 gfp_t sk_allocation; 254 gfp_t sk_allocation;
@@ -269,7 +280,9 @@ struct sock {
269 struct sk_buff *sk_send_head; 280 struct sk_buff *sk_send_head;
270 __u32 sk_sndmsg_off; 281 __u32 sk_sndmsg_off;
271 int sk_write_pending; 282 int sk_write_pending;
283#ifdef CONFIG_SECURITY
272 void *sk_security; 284 void *sk_security;
285#endif
273 __u32 sk_mark; 286 __u32 sk_mark;
274 /* XXX 4 bytes hole on 64 bit */ 287 /* XXX 4 bytes hole on 64 bit */
275 void (*sk_state_change)(struct sock *sk); 288 void (*sk_state_change)(struct sock *sk);
@@ -294,12 +307,30 @@ static inline struct sock *sk_head(const struct hlist_head *head)
294 return hlist_empty(head) ? NULL : __sk_head(head); 307 return hlist_empty(head) ? NULL : __sk_head(head);
295} 308}
296 309
310static inline struct sock *__sk_nulls_head(const struct hlist_nulls_head *head)
311{
312 return hlist_nulls_entry(head->first, struct sock, sk_nulls_node);
313}
314
315static inline struct sock *sk_nulls_head(const struct hlist_nulls_head *head)
316{
317 return hlist_nulls_empty(head) ? NULL : __sk_nulls_head(head);
318}
319
297static inline struct sock *sk_next(const struct sock *sk) 320static inline struct sock *sk_next(const struct sock *sk)
298{ 321{
299 return sk->sk_node.next ? 322 return sk->sk_node.next ?
300 hlist_entry(sk->sk_node.next, struct sock, sk_node) : NULL; 323 hlist_entry(sk->sk_node.next, struct sock, sk_node) : NULL;
301} 324}
302 325
326static inline struct sock *sk_nulls_next(const struct sock *sk)
327{
328 return (!is_a_nulls(sk->sk_nulls_node.next)) ?
329 hlist_nulls_entry(sk->sk_nulls_node.next,
330 struct sock, sk_nulls_node) :
331 NULL;
332}
333
303static inline int sk_unhashed(const struct sock *sk) 334static inline int sk_unhashed(const struct sock *sk)
304{ 335{
305 return hlist_unhashed(&sk->sk_node); 336 return hlist_unhashed(&sk->sk_node);
@@ -315,6 +346,11 @@ static __inline__ void sk_node_init(struct hlist_node *node)
315 node->pprev = NULL; 346 node->pprev = NULL;
316} 347}
317 348
349static __inline__ void sk_nulls_node_init(struct hlist_nulls_node *node)
350{
351 node->pprev = NULL;
352}
353
318static __inline__ void __sk_del_node(struct sock *sk) 354static __inline__ void __sk_del_node(struct sock *sk)
319{ 355{
320 __hlist_del(&sk->sk_node); 356 __hlist_del(&sk->sk_node);
@@ -361,6 +397,27 @@ static __inline__ int sk_del_node_init(struct sock *sk)
361 return rc; 397 return rc;
362} 398}
363 399
400static __inline__ int __sk_nulls_del_node_init_rcu(struct sock *sk)
401{
402 if (sk_hashed(sk)) {
403 hlist_nulls_del_init_rcu(&sk->sk_nulls_node);
404 return 1;
405 }
406 return 0;
407}
408
409static __inline__ int sk_nulls_del_node_init_rcu(struct sock *sk)
410{
411 int rc = __sk_nulls_del_node_init_rcu(sk);
412
413 if (rc) {
414 /* paranoid for a while -acme */
415 WARN_ON(atomic_read(&sk->sk_refcnt) == 1);
416 __sock_put(sk);
417 }
418 return rc;
419}
420
364static __inline__ void __sk_add_node(struct sock *sk, struct hlist_head *list) 421static __inline__ void __sk_add_node(struct sock *sk, struct hlist_head *list)
365{ 422{
366 hlist_add_head(&sk->sk_node, list); 423 hlist_add_head(&sk->sk_node, list);
@@ -372,6 +429,17 @@ static __inline__ void sk_add_node(struct sock *sk, struct hlist_head *list)
372 __sk_add_node(sk, list); 429 __sk_add_node(sk, list);
373} 430}
374 431
432static __inline__ void __sk_nulls_add_node_rcu(struct sock *sk, struct hlist_nulls_head *list)
433{
434 hlist_nulls_add_head_rcu(&sk->sk_nulls_node, list);
435}
436
437static __inline__ void sk_nulls_add_node_rcu(struct sock *sk, struct hlist_nulls_head *list)
438{
439 sock_hold(sk);
440 __sk_nulls_add_node_rcu(sk, list);
441}
442
375static __inline__ void __sk_del_bind_node(struct sock *sk) 443static __inline__ void __sk_del_bind_node(struct sock *sk)
376{ 444{
377 __hlist_del(&sk->sk_bind_node); 445 __hlist_del(&sk->sk_bind_node);
@@ -385,9 +453,16 @@ static __inline__ void sk_add_bind_node(struct sock *sk,
385 453
386#define sk_for_each(__sk, node, list) \ 454#define sk_for_each(__sk, node, list) \
387 hlist_for_each_entry(__sk, node, list, sk_node) 455 hlist_for_each_entry(__sk, node, list, sk_node)
456#define sk_nulls_for_each(__sk, node, list) \
457 hlist_nulls_for_each_entry(__sk, node, list, sk_nulls_node)
458#define sk_nulls_for_each_rcu(__sk, node, list) \
459 hlist_nulls_for_each_entry_rcu(__sk, node, list, sk_nulls_node)
388#define sk_for_each_from(__sk, node) \ 460#define sk_for_each_from(__sk, node) \
389 if (__sk && ({ node = &(__sk)->sk_node; 1; })) \ 461 if (__sk && ({ node = &(__sk)->sk_node; 1; })) \
390 hlist_for_each_entry_from(__sk, node, sk_node) 462 hlist_for_each_entry_from(__sk, node, sk_node)
463#define sk_nulls_for_each_from(__sk, node) \
464 if (__sk && ({ node = &(__sk)->sk_nulls_node; 1; })) \
465 hlist_nulls_for_each_entry_from(__sk, node, sk_nulls_node)
391#define sk_for_each_continue(__sk, node) \ 466#define sk_for_each_continue(__sk, node) \
392 if (__sk && ({ node = &(__sk)->sk_node; 1; })) \ 467 if (__sk && ({ node = &(__sk)->sk_node; 1; })) \
393 hlist_for_each_entry_continue(__sk, node, sk_node) 468 hlist_for_each_entry_continue(__sk, node, sk_node)
@@ -574,7 +649,7 @@ struct proto {
574 /* Memory pressure */ 649 /* Memory pressure */
575 void (*enter_memory_pressure)(struct sock *sk); 650 void (*enter_memory_pressure)(struct sock *sk);
576 atomic_t *memory_allocated; /* Current allocated memory. */ 651 atomic_t *memory_allocated; /* Current allocated memory. */
577 atomic_t *sockets_allocated; /* Current number of sockets. */ 652 struct percpu_counter *sockets_allocated; /* Current number of sockets. */
578 /* 653 /*
579 * Pressure flag: try to collapse. 654 * Pressure flag: try to collapse.
580 * Technical note: it is used by multiple contexts non atomically. 655 * Technical note: it is used by multiple contexts non atomically.
@@ -587,17 +662,18 @@ struct proto {
587 int *sysctl_rmem; 662 int *sysctl_rmem;
588 int max_header; 663 int max_header;
589 664
590 struct kmem_cache *slab; 665 struct kmem_cache *slab;
591 unsigned int obj_size; 666 unsigned int obj_size;
667 int slab_flags;
592 668
593 atomic_t *orphan_count; 669 struct percpu_counter *orphan_count;
594 670
595 struct request_sock_ops *rsk_prot; 671 struct request_sock_ops *rsk_prot;
596 struct timewait_sock_ops *twsk_prot; 672 struct timewait_sock_ops *twsk_prot;
597 673
598 union { 674 union {
599 struct inet_hashinfo *hashinfo; 675 struct inet_hashinfo *hashinfo;
600 struct hlist_head *udp_hash; 676 struct udp_table *udp_table;
601 struct raw_hashinfo *raw_hash; 677 struct raw_hashinfo *raw_hash;
602 } h; 678 } h;
603 679
diff --git a/include/net/syncppp.h b/include/net/syncppp.h
deleted file mode 100644
index 9e306f7f579..00000000000
--- a/include/net/syncppp.h
+++ /dev/null
@@ -1,102 +0,0 @@
1/*
2 * Defines for synchronous PPP/Cisco link level subroutines.
3 *
4 * Copyright (C) 1994 Cronyx Ltd.
5 * Author: Serge Vakulenko, <vak@zebub.msk.su>
6 *
7 * This software is distributed with NO WARRANTIES, not even the implied
8 * warranties for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9 *
10 * Authors grant any other persons or organizations permission to use
11 * or modify this software as long as this message is kept with the software,
12 * all derivative works or modified versions.
13 *
14 * Version 1.7, Wed Jun 7 22:12:02 MSD 1995
15 *
16 *
17 *
18 */
19
20#ifndef _SYNCPPP_H_
21#define _SYNCPPP_H_ 1
22
23#ifdef __KERNEL__
24struct slcp {
25 u16 state; /* state machine */
26 u32 magic; /* local magic number */
27 u_char echoid; /* id of last keepalive echo request */
28 u_char confid; /* id of last configuration request */
29};
30
31struct sipcp {
32 u16 state; /* state machine */
33 u_char confid; /* id of last configuration request */
34};
35
36struct sppp
37{
38 struct sppp * pp_next; /* next interface in keepalive list */
39 u32 pp_flags; /* use Cisco protocol instead of PPP */
40 u16 pp_alivecnt; /* keepalive packets counter */
41 u16 pp_loopcnt; /* loopback detection counter */
42 u32 pp_seq; /* local sequence number */
43 u32 pp_rseq; /* remote sequence number */
44 struct slcp lcp; /* LCP params */
45 struct sipcp ipcp; /* IPCP params */
46 struct timer_list pp_timer;
47 struct net_device *pp_if;
48 char pp_link_state; /* Link status */
49 spinlock_t lock;
50};
51
52struct ppp_device
53{
54 struct net_device *dev; /* Network device pointer */
55 struct sppp sppp; /* Synchronous PPP */
56};
57
58static inline struct sppp *sppp_of(struct net_device *dev)
59{
60 struct ppp_device **ppp = dev->ml_priv;
61 BUG_ON((*ppp)->dev != dev);
62 return &(*ppp)->sppp;
63}
64
65#define PP_KEEPALIVE 0x01 /* use keepalive protocol */
66#define PP_CISCO 0x02 /* use Cisco protocol instead of PPP */
67#define PP_TIMO 0x04 /* cp_timeout routine active */
68#define PP_DEBUG 0x08
69
70#define PPP_MTU 1500 /* max. transmit unit */
71
72#define LCP_STATE_CLOSED 0 /* LCP state: closed (conf-req sent) */
73#define LCP_STATE_ACK_RCVD 1 /* LCP state: conf-ack received */
74#define LCP_STATE_ACK_SENT 2 /* LCP state: conf-ack sent */
75#define LCP_STATE_OPENED 3 /* LCP state: opened */
76
77#define IPCP_STATE_CLOSED 0 /* IPCP state: closed (conf-req sent) */
78#define IPCP_STATE_ACK_RCVD 1 /* IPCP state: conf-ack received */
79#define IPCP_STATE_ACK_SENT 2 /* IPCP state: conf-ack sent */
80#define IPCP_STATE_OPENED 3 /* IPCP state: opened */
81
82#define SPPP_LINK_DOWN 0 /* link down - no keepalive */
83#define SPPP_LINK_UP 1 /* link is up - keepalive ok */
84
85void sppp_attach (struct ppp_device *pd);
86void sppp_detach (struct net_device *dev);
87int sppp_do_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd);
88struct sk_buff *sppp_dequeue (struct net_device *dev);
89int sppp_isempty (struct net_device *dev);
90void sppp_flush (struct net_device *dev);
91int sppp_open (struct net_device *dev);
92int sppp_reopen (struct net_device *dev);
93int sppp_close (struct net_device *dev);
94#endif
95
96#define SPPPIOCCISCO (SIOCDEVPRIVATE)
97#define SPPPIOCPPP (SIOCDEVPRIVATE+1)
98#define SPPPIOCDEBUG (SIOCDEVPRIVATE+2)
99#define SPPPIOCSFLAGS (SIOCDEVPRIVATE+3)
100#define SPPPIOCGFLAGS (SIOCDEVPRIVATE+4)
101
102#endif /* _SYNCPPP_H_ */
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 438014d5761..218235de896 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -46,7 +46,7 @@
46 46
47extern struct inet_hashinfo tcp_hashinfo; 47extern struct inet_hashinfo tcp_hashinfo;
48 48
49extern atomic_t tcp_orphan_count; 49extern struct percpu_counter tcp_orphan_count;
50extern void tcp_time_wait(struct sock *sk, int state, int timeo); 50extern void tcp_time_wait(struct sock *sk, int state, int timeo);
51 51
52#define MAX_TCP_HEADER (128 + MAX_HEADER) 52#define MAX_TCP_HEADER (128 + MAX_HEADER)
@@ -238,7 +238,7 @@ extern int sysctl_tcp_slow_start_after_idle;
238extern int sysctl_tcp_max_ssthresh; 238extern int sysctl_tcp_max_ssthresh;
239 239
240extern atomic_t tcp_memory_allocated; 240extern atomic_t tcp_memory_allocated;
241extern atomic_t tcp_sockets_allocated; 241extern struct percpu_counter tcp_sockets_allocated;
242extern int tcp_memory_pressure; 242extern int tcp_memory_pressure;
243 243
244/* 244/*
@@ -472,8 +472,6 @@ extern void tcp_send_delayed_ack(struct sock *sk);
472 472
473/* tcp_input.c */ 473/* tcp_input.c */
474extern void tcp_cwnd_application_limited(struct sock *sk); 474extern void tcp_cwnd_application_limited(struct sock *sk);
475extern void tcp_skb_mark_lost_uncond_verify(struct tcp_sock *tp,
476 struct sk_buff *skb);
477 475
478/* tcp_timer.c */ 476/* tcp_timer.c */
479extern void tcp_init_xmit_timers(struct sock *); 477extern void tcp_init_xmit_timers(struct sock *);
@@ -590,7 +588,6 @@ struct tcp_skb_cb {
590#define TCPCB_EVER_RETRANS 0x80 /* Ever retransmitted frame */ 588#define TCPCB_EVER_RETRANS 0x80 /* Ever retransmitted frame */
591#define TCPCB_RETRANS (TCPCB_SACKED_RETRANS|TCPCB_EVER_RETRANS) 589#define TCPCB_RETRANS (TCPCB_SACKED_RETRANS|TCPCB_EVER_RETRANS)
592 590
593 __u16 urg_ptr; /* Valid w/URG flags is set. */
594 __u32 ack_seq; /* Sequence number ACK'd */ 591 __u32 ack_seq; /* Sequence number ACK'd */
595}; 592};
596 593
@@ -764,8 +761,6 @@ static inline unsigned int tcp_packets_in_flight(const struct tcp_sock *tp)
764 return tp->packets_out - tcp_left_out(tp) + tp->retrans_out; 761 return tp->packets_out - tcp_left_out(tp) + tp->retrans_out;
765} 762}
766 763
767extern int tcp_limit_reno_sacked(struct tcp_sock *tp);
768
769/* If cwnd > ssthresh, we may raise ssthresh to be half-way to cwnd. 764/* If cwnd > ssthresh, we may raise ssthresh to be half-way to cwnd.
770 * The exception is rate halving phase, when cwnd is decreasing towards 765 * The exception is rate halving phase, when cwnd is decreasing towards
771 * ssthresh. 766 * ssthresh.
@@ -1195,6 +1190,11 @@ static inline struct sk_buff *tcp_write_queue_next(struct sock *sk, struct sk_bu
1195 return skb_queue_next(&sk->sk_write_queue, skb); 1190 return skb_queue_next(&sk->sk_write_queue, skb);
1196} 1191}
1197 1192
1193static inline struct sk_buff *tcp_write_queue_prev(struct sock *sk, struct sk_buff *skb)
1194{
1195 return skb_queue_prev(&sk->sk_write_queue, skb);
1196}
1197
1198#define tcp_for_write_queue(skb, sk) \ 1198#define tcp_for_write_queue(skb, sk) \
1199 skb_queue_walk(&(sk)->sk_write_queue, skb) 1199 skb_queue_walk(&(sk)->sk_write_queue, skb)
1200 1200
@@ -1358,6 +1358,12 @@ extern void tcp_v4_destroy_sock(struct sock *sk);
1358 1358
1359extern int tcp_v4_gso_send_check(struct sk_buff *skb); 1359extern int tcp_v4_gso_send_check(struct sk_buff *skb);
1360extern struct sk_buff *tcp_tso_segment(struct sk_buff *skb, int features); 1360extern struct sk_buff *tcp_tso_segment(struct sk_buff *skb, int features);
1361extern struct sk_buff **tcp_gro_receive(struct sk_buff **head,
1362 struct sk_buff *skb);
1363extern struct sk_buff **tcp4_gro_receive(struct sk_buff **head,
1364 struct sk_buff *skb);
1365extern int tcp_gro_complete(struct sk_buff *skb);
1366extern int tcp4_gro_complete(struct sk_buff *skb);
1361 1367
1362#ifdef CONFIG_PROC_FS 1368#ifdef CONFIG_PROC_FS
1363extern int tcp4_proc_init(void); 1369extern int tcp4_proc_init(void);
diff --git a/include/net/udp.h b/include/net/udp.h
index 1e205095ea6..90e6ce56be6 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -50,8 +50,15 @@ struct udp_skb_cb {
50}; 50};
51#define UDP_SKB_CB(__skb) ((struct udp_skb_cb *)((__skb)->cb)) 51#define UDP_SKB_CB(__skb) ((struct udp_skb_cb *)((__skb)->cb))
52 52
53extern struct hlist_head udp_hash[UDP_HTABLE_SIZE]; 53struct udp_hslot {
54extern rwlock_t udp_hash_lock; 54 struct hlist_nulls_head head;
55 spinlock_t lock;
56} __attribute__((aligned(2 * sizeof(long))));
57struct udp_table {
58 struct udp_hslot hash[UDP_HTABLE_SIZE];
59};
60extern struct udp_table udp_table;
61extern void udp_table_init(struct udp_table *);
55 62
56 63
57/* Note: this must match 'valbool' in sock_setsockopt */ 64/* Note: this must match 'valbool' in sock_setsockopt */
@@ -110,15 +117,7 @@ static inline void udp_lib_hash(struct sock *sk)
110 BUG(); 117 BUG();
111} 118}
112 119
113static inline void udp_lib_unhash(struct sock *sk) 120extern void udp_lib_unhash(struct sock *sk);
114{
115 write_lock_bh(&udp_hash_lock);
116 if (sk_del_node_init(sk)) {
117 inet_sk(sk)->num = 0;
118 sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1);
119 }
120 write_unlock_bh(&udp_hash_lock);
121}
122 121
123static inline void udp_lib_close(struct sock *sk, long timeout) 122static inline void udp_lib_close(struct sock *sk, long timeout)
124{ 123{
@@ -187,7 +186,7 @@ extern struct sock *udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport,
187struct udp_seq_afinfo { 186struct udp_seq_afinfo {
188 char *name; 187 char *name;
189 sa_family_t family; 188 sa_family_t family;
190 struct hlist_head *hashtable; 189 struct udp_table *udp_table;
191 struct file_operations seq_fops; 190 struct file_operations seq_fops;
192 struct seq_operations seq_ops; 191 struct seq_operations seq_ops;
193}; 192};
@@ -196,7 +195,7 @@ struct udp_iter_state {
196 struct seq_net_private p; 195 struct seq_net_private p;
197 sa_family_t family; 196 sa_family_t family;
198 int bucket; 197 int bucket;
199 struct hlist_head *hashtable; 198 struct udp_table *udp_table;
200}; 199};
201 200
202#ifdef CONFIG_PROC_FS 201#ifdef CONFIG_PROC_FS
diff --git a/include/net/udplite.h b/include/net/udplite.h
index b76b2e377af..afdffe607b2 100644
--- a/include/net/udplite.h
+++ b/include/net/udplite.h
@@ -11,7 +11,7 @@
11#define UDPLITE_RECV_CSCOV 11 /* receiver partial coverage (threshold ) */ 11#define UDPLITE_RECV_CSCOV 11 /* receiver partial coverage (threshold ) */
12 12
13extern struct proto udplite_prot; 13extern struct proto udplite_prot;
14extern struct hlist_head udplite_hash[UDP_HTABLE_SIZE]; 14extern struct udp_table udplite_table;
15 15
16/* 16/*
17 * Checksum computation is all in software, hence simpler getfrag. 17 * Checksum computation is all in software, hence simpler getfrag.
diff --git a/include/net/wireless.h b/include/net/wireless.h
index 721efb363db..21c5d966142 100644
--- a/include/net/wireless.h
+++ b/include/net/wireless.h
@@ -10,6 +10,7 @@
10#include <linux/netdevice.h> 10#include <linux/netdevice.h>
11#include <linux/debugfs.h> 11#include <linux/debugfs.h>
12#include <linux/list.h> 12#include <linux/list.h>
13#include <linux/ieee80211.h>
13#include <net/cfg80211.h> 14#include <net/cfg80211.h>
14 15
15/** 16/**
@@ -133,23 +134,23 @@ struct ieee80211_rate {
133}; 134};
134 135
135/** 136/**
136 * struct ieee80211_ht_info - describing STA's HT capabilities 137 * struct ieee80211_sta_ht_cap - STA's HT capabilities
137 * 138 *
138 * This structure describes most essential parameters needed 139 * This structure describes most essential parameters needed
139 * to describe 802.11n HT capabilities for an STA. 140 * to describe 802.11n HT capabilities for an STA.
140 * 141 *
141 * @ht_supported: is HT supported by STA, 0: no, 1: yes 142 * @ht_supported: is HT supported by the STA
142 * @cap: HT capabilities map as described in 802.11n spec 143 * @cap: HT capabilities map as described in 802.11n spec
143 * @ampdu_factor: Maximum A-MPDU length factor 144 * @ampdu_factor: Maximum A-MPDU length factor
144 * @ampdu_density: Minimum A-MPDU spacing 145 * @ampdu_density: Minimum A-MPDU spacing
145 * @supp_mcs_set: Supported MCS set as described in 802.11n spec 146 * @mcs: Supported MCS rates
146 */ 147 */
147struct ieee80211_ht_info { 148struct ieee80211_sta_ht_cap {
148 u16 cap; /* use IEEE80211_HT_CAP_ */ 149 u16 cap; /* use IEEE80211_HT_CAP_ */
149 u8 ht_supported; 150 bool ht_supported;
150 u8 ampdu_factor; 151 u8 ampdu_factor;
151 u8 ampdu_density; 152 u8 ampdu_density;
152 u8 supp_mcs_set[16]; 153 struct ieee80211_mcs_info mcs;
153}; 154};
154 155
155/** 156/**
@@ -173,13 +174,18 @@ struct ieee80211_supported_band {
173 enum ieee80211_band band; 174 enum ieee80211_band band;
174 int n_channels; 175 int n_channels;
175 int n_bitrates; 176 int n_bitrates;
176 struct ieee80211_ht_info ht_info; 177 struct ieee80211_sta_ht_cap ht_cap;
177}; 178};
178 179
179/** 180/**
180 * struct wiphy - wireless hardware description 181 * struct wiphy - wireless hardware description
181 * @idx: the wiphy index assigned to this item 182 * @idx: the wiphy index assigned to this item
182 * @class_dev: the class device representing /sys/class/ieee80211/<wiphy-name> 183 * @class_dev: the class device representing /sys/class/ieee80211/<wiphy-name>
184 * @fw_handles_regulatory: tells us the firmware for this device
185 * has its own regulatory solution and cannot identify the
186 * ISO / IEC 3166 alpha2 it belongs to. When this is enabled
187 * we will disregard the first regulatory hint (when the
188 * initiator is %REGDOM_SET_BY_CORE).
183 * @reg_notifier: the driver's regulatory notification callback 189 * @reg_notifier: the driver's regulatory notification callback
184 */ 190 */
185struct wiphy { 191struct wiphy {
@@ -191,6 +197,8 @@ struct wiphy {
191 /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */ 197 /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
192 u16 interface_modes; 198 u16 interface_modes;
193 199
200 bool fw_handles_regulatory;
201
194 /* If multiple wiphys are registered and you're handed e.g. 202 /* If multiple wiphys are registered and you're handed e.g.
195 * a regular netdev with assigned ieee80211_ptr, you won't 203 * a regular netdev with assigned ieee80211_ptr, you won't
196 * know whether it points to a wiphy your driver has registered 204 * know whether it points to a wiphy your driver has registered
@@ -262,9 +270,9 @@ static inline struct device *wiphy_dev(struct wiphy *wiphy)
262/** 270/**
263 * wiphy_name - get wiphy name 271 * wiphy_name - get wiphy name
264 */ 272 */
265static inline char *wiphy_name(struct wiphy *wiphy) 273static inline const char *wiphy_name(struct wiphy *wiphy)
266{ 274{
267 return wiphy->dev.bus_id; 275 return dev_name(&wiphy->dev);
268} 276}
269 277
270/** 278/**
@@ -340,55 +348,51 @@ ieee80211_get_channel(struct wiphy *wiphy, int freq)
340} 348}
341 349
342/** 350/**
343 * __regulatory_hint - hint to the wireless core a regulatory domain 351 * ieee80211_get_response_rate - get basic rate for a given rate
344 * @wiphy: if a driver is providing the hint this is the driver's very
345 * own &struct wiphy
346 * @alpha2: the ISO/IEC 3166 alpha2 being claimed the regulatory domain
347 * should be in. If @rd is set this should be NULL
348 * @rd: a complete regulatory domain, if passed the caller need not worry
349 * about freeing it
350 *
351 * The Wireless subsystem can use this function to hint to the wireless core
352 * what it believes should be the current regulatory domain by
353 * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory
354 * domain should be in or by providing a completely build regulatory domain.
355 * 352 *
356 * Returns -EALREADY if *a regulatory domain* has already been set. Note that 353 * @sband: the band to look for rates in
357 * this could be by another driver. It is safe for drivers to continue if 354 * @basic_rates: bitmap of basic rates
358 * -EALREADY is returned, if drivers are not capable of world roaming they 355 * @bitrate: the bitrate for which to find the basic rate
359 * should not register more channels than they support. Right now we only
360 * support listening to the first driver hint. If the driver is capable
361 * of world roaming but wants to respect its own EEPROM mappings for
362 * specific regulatory domains it should register the @reg_notifier callback
363 * on the &struct wiphy. Returns 0 if the hint went through fine or through an
364 * intersection operation. Otherwise a standard error code is returned.
365 * 356 *
357 * This function returns the basic rate corresponding to a given
358 * bitrate, that is the next lower bitrate contained in the basic
359 * rate map, which is, for this function, given as a bitmap of
360 * indices of rates in the band's bitrate table.
366 */ 361 */
367extern int __regulatory_hint(struct wiphy *wiphy, enum reg_set_by set_by, 362struct ieee80211_rate *
368 const char *alpha2, struct ieee80211_regdomain *rd); 363ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
364 u64 basic_rates, int bitrate);
365
369/** 366/**
370 * regulatory_hint - driver hint to the wireless core a regulatory domain 367 * regulatory_hint - driver hint to the wireless core a regulatory domain
371 * @wiphy: the driver's very own &struct wiphy 368 * @wiphy: the wireless device giving the hint (used only for reporting
369 * conflicts)
372 * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain 370 * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain
373 * should be in. If @rd is set this should be NULL. Note that if you 371 * should be in. If @rd is set this should be NULL. Note that if you
374 * set this to NULL you should still set rd->alpha2 to some accepted 372 * set this to NULL you should still set rd->alpha2 to some accepted
375 * alpha2. 373 * alpha2.
376 * @rd: a complete regulatory domain provided by the driver. If passed
377 * the driver does not need to worry about freeing it.
378 * 374 *
379 * Wireless drivers can use this function to hint to the wireless core 375 * Wireless drivers can use this function to hint to the wireless core
380 * what it believes should be the current regulatory domain by 376 * what it believes should be the current regulatory domain by
381 * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory 377 * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory
382 * domain should be in or by providing a completely build regulatory domain. 378 * domain should be in or by providing a completely build regulatory domain.
383 * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried 379 * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried
384 * for a regulatory domain structure for the respective country. If 380 * for a regulatory domain structure for the respective country.
385 * a regulatory domain is build and passed you should set the alpha2 381 */
386 * if possible, otherwise set it to the special value of "99" which tells 382extern void regulatory_hint(struct wiphy *wiphy, const char *alpha2);
387 * the wireless core it is unknown. If you pass a built regulatory domain 383
388 * and we return non zero you are in charge of kfree()'ing the structure. 384/**
385 * regulatory_hint_11d - hints a country IE as a regulatory domain
386 * @wiphy: the wireless device giving the hint (used only for reporting
387 * conflicts)
388 * @country_ie: pointer to the country IE
389 * @country_ie_len: length of the country IE
389 * 390 *
390 * See __regulatory_hint() documentation for possible return values. 391 * We will intersect the rd with the what CRDA tells us should apply
392 * for the alpha2 this country IE belongs to, this prevents APs from
393 * sending us incorrect or outdated information against a country.
391 */ 394 */
392extern int regulatory_hint(struct wiphy *wiphy, 395extern void regulatory_hint_11d(struct wiphy *wiphy,
393 const char *alpha2, struct ieee80211_regdomain *rd); 396 u8 *country_ie,
397 u8 country_ie_len);
394#endif /* __NET_WIRELESS_H */ 398#endif /* __NET_WIRELESS_H */
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 11c890ad8eb..2e9f5c0018a 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -38,22 +38,15 @@
38 MODULE_ALIAS("xfrm-type-" __stringify(family) "-" __stringify(proto)) 38 MODULE_ALIAS("xfrm-type-" __stringify(family) "-" __stringify(proto))
39 39
40#ifdef CONFIG_XFRM_STATISTICS 40#ifdef CONFIG_XFRM_STATISTICS
41DECLARE_SNMP_STAT(struct linux_xfrm_mib, xfrm_statistics); 41#define XFRM_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.xfrm_statistics, field)
42#define XFRM_INC_STATS(field) SNMP_INC_STATS(xfrm_statistics, field) 42#define XFRM_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.xfrm_statistics, field)
43#define XFRM_INC_STATS_BH(field) SNMP_INC_STATS_BH(xfrm_statistics, field) 43#define XFRM_INC_STATS_USER(net, field) SNMP_INC_STATS_USER((net)-mib.xfrm_statistics, field)
44#define XFRM_INC_STATS_USER(field) SNMP_INC_STATS_USER(xfrm_statistics, field)
45#else 44#else
46#define XFRM_INC_STATS(field) 45#define XFRM_INC_STATS(net, field) ((void)(net))
47#define XFRM_INC_STATS_BH(field) 46#define XFRM_INC_STATS_BH(net, field) ((void)(net))
48#define XFRM_INC_STATS_USER(field) 47#define XFRM_INC_STATS_USER(net, field) ((void)(net))
49#endif 48#endif
50 49
51extern struct sock *xfrm_nl;
52extern u32 sysctl_xfrm_aevent_etime;
53extern u32 sysctl_xfrm_aevent_rseqth;
54extern int sysctl_xfrm_larval_drop;
55extern u32 sysctl_xfrm_acq_expires;
56
57extern struct mutex xfrm_cfg_mutex; 50extern struct mutex xfrm_cfg_mutex;
58 51
59/* Organization of SPD aka "XFRM rules" 52/* Organization of SPD aka "XFRM rules"
@@ -130,6 +123,9 @@ struct xfrm_state_walk {
130/* Full description of state of transformer. */ 123/* Full description of state of transformer. */
131struct xfrm_state 124struct xfrm_state
132{ 125{
126#ifdef CONFIG_NET_NS
127 struct net *xs_net;
128#endif
133 union { 129 union {
134 struct hlist_node gclist; 130 struct hlist_node gclist;
135 struct hlist_node bydst; 131 struct hlist_node bydst;
@@ -223,6 +219,11 @@ struct xfrm_state
223 void *data; 219 void *data;
224}; 220};
225 221
222static inline struct net *xs_net(struct xfrm_state *x)
223{
224 return read_pnet(&x->xs_net);
225}
226
226/* xflags - make enum if more show up */ 227/* xflags - make enum if more show up */
227#define XFRM_TIME_DEFER 1 228#define XFRM_TIME_DEFER 1
228 229
@@ -249,6 +250,7 @@ struct km_event
249 u32 seq; 250 u32 seq;
250 u32 pid; 251 u32 pid;
251 u32 event; 252 u32 event;
253 struct net *net;
252}; 254};
253 255
254struct net_device; 256struct net_device;
@@ -257,10 +259,11 @@ struct xfrm_dst;
257struct xfrm_policy_afinfo { 259struct xfrm_policy_afinfo {
258 unsigned short family; 260 unsigned short family;
259 struct dst_ops *dst_ops; 261 struct dst_ops *dst_ops;
260 void (*garbage_collect)(void); 262 void (*garbage_collect)(struct net *net);
261 struct dst_entry *(*dst_lookup)(int tos, xfrm_address_t *saddr, 263 struct dst_entry *(*dst_lookup)(struct net *net, int tos,
264 xfrm_address_t *saddr,
262 xfrm_address_t *daddr); 265 xfrm_address_t *daddr);
263 int (*get_saddr)(xfrm_address_t *saddr, xfrm_address_t *daddr); 266 int (*get_saddr)(struct net *net, xfrm_address_t *saddr, xfrm_address_t *daddr);
264 struct dst_entry *(*find_bundle)(struct flowi *fl, struct xfrm_policy *policy); 267 struct dst_entry *(*find_bundle)(struct flowi *fl, struct xfrm_policy *policy);
265 void (*decode_session)(struct sk_buff *skb, 268 void (*decode_session)(struct sk_buff *skb,
266 struct flowi *fl, 269 struct flowi *fl,
@@ -467,7 +470,9 @@ struct xfrm_policy_walk {
467 470
468struct xfrm_policy 471struct xfrm_policy
469{ 472{
470 struct xfrm_policy *next; 473#ifdef CONFIG_NET_NS
474 struct net *xp_net;
475#endif
471 struct hlist_node bydst; 476 struct hlist_node bydst;
472 struct hlist_node byidx; 477 struct hlist_node byidx;
473 478
@@ -492,6 +497,11 @@ struct xfrm_policy
492 struct xfrm_tmpl xfrm_vec[XFRM_MAX_DEPTH]; 497 struct xfrm_tmpl xfrm_vec[XFRM_MAX_DEPTH];
493}; 498};
494 499
500static inline struct net *xp_net(struct xfrm_policy *xp)
501{
502 return read_pnet(&xp->xp_net);
503}
504
495struct xfrm_kmaddress { 505struct xfrm_kmaddress {
496 xfrm_address_t local; 506 xfrm_address_t local;
497 xfrm_address_t remote; 507 xfrm_address_t remote;
@@ -537,15 +547,13 @@ struct xfrm_mgr
537 struct xfrm_policy *(*compile_policy)(struct sock *sk, int opt, u8 *data, int len, int *dir); 547 struct xfrm_policy *(*compile_policy)(struct sock *sk, int opt, u8 *data, int len, int *dir);
538 int (*new_mapping)(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport); 548 int (*new_mapping)(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport);
539 int (*notify_policy)(struct xfrm_policy *x, int dir, struct km_event *c); 549 int (*notify_policy)(struct xfrm_policy *x, int dir, struct km_event *c);
540 int (*report)(u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr); 550 int (*report)(struct net *net, u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr);
541 int (*migrate)(struct xfrm_selector *sel, u8 dir, u8 type, struct xfrm_migrate *m, int num_bundles, struct xfrm_kmaddress *k); 551 int (*migrate)(struct xfrm_selector *sel, u8 dir, u8 type, struct xfrm_migrate *m, int num_bundles, struct xfrm_kmaddress *k);
542}; 552};
543 553
544extern int xfrm_register_km(struct xfrm_mgr *km); 554extern int xfrm_register_km(struct xfrm_mgr *km);
545extern int xfrm_unregister_km(struct xfrm_mgr *km); 555extern int xfrm_unregister_km(struct xfrm_mgr *km);
546 556
547extern unsigned int xfrm_policy_count[XFRM_POLICY_MAX*2];
548
549/* 557/*
550 * This structure is used for the duration where packets are being 558 * This structure is used for the duration where packets are being
551 * transformed by IPsec. As soon as the packet leaves IPsec the 559 * transformed by IPsec. As soon as the packet leaves IPsec the
@@ -882,6 +890,7 @@ struct xfrm_dst
882 u32 path_cookie; 890 u32 path_cookie;
883}; 891};
884 892
893#ifdef CONFIG_XFRM
885static inline void xfrm_dst_destroy(struct xfrm_dst *xdst) 894static inline void xfrm_dst_destroy(struct xfrm_dst *xdst)
886{ 895{
887 dst_release(xdst->route); 896 dst_release(xdst->route);
@@ -894,6 +903,7 @@ static inline void xfrm_dst_destroy(struct xfrm_dst *xdst)
894 xdst->partner = NULL; 903 xdst->partner = NULL;
895#endif 904#endif
896} 905}
906#endif
897 907
898extern void xfrm_dst_ifdown(struct dst_entry *dst, struct net_device *dev); 908extern void xfrm_dst_ifdown(struct dst_entry *dst, struct net_device *dev);
899 909
@@ -977,12 +987,13 @@ static inline int __xfrm_policy_check2(struct sock *sk, int dir,
977 struct sk_buff *skb, 987 struct sk_buff *skb,
978 unsigned int family, int reverse) 988 unsigned int family, int reverse)
979{ 989{
990 struct net *net = dev_net(skb->dev);
980 int ndir = dir | (reverse ? XFRM_POLICY_MASK + 1 : 0); 991 int ndir = dir | (reverse ? XFRM_POLICY_MASK + 1 : 0);
981 992
982 if (sk && sk->sk_policy[XFRM_POLICY_IN]) 993 if (sk && sk->sk_policy[XFRM_POLICY_IN])
983 return __xfrm_policy_check(sk, ndir, skb, family); 994 return __xfrm_policy_check(sk, ndir, skb, family);
984 995
985 return (!xfrm_policy_count[dir] && !skb->sp) || 996 return (!net->xfrm.policy_count[dir] && !skb->sp) ||
986 (skb->dst->flags & DST_NOPOLICY) || 997 (skb->dst->flags & DST_NOPOLICY) ||
987 __xfrm_policy_check(sk, ndir, skb, family); 998 __xfrm_policy_check(sk, ndir, skb, family);
988} 999}
@@ -1034,7 +1045,9 @@ extern int __xfrm_route_forward(struct sk_buff *skb, unsigned short family);
1034 1045
1035static inline int xfrm_route_forward(struct sk_buff *skb, unsigned short family) 1046static inline int xfrm_route_forward(struct sk_buff *skb, unsigned short family)
1036{ 1047{
1037 return !xfrm_policy_count[XFRM_POLICY_OUT] || 1048 struct net *net = dev_net(skb->dev);
1049
1050 return !net->xfrm.policy_count[XFRM_POLICY_OUT] ||
1038 (skb->dst->flags & DST_NOXFRM) || 1051 (skb->dst->flags & DST_NOXFRM) ||
1039 __xfrm_route_forward(skb, family); 1052 __xfrm_route_forward(skb, family);
1040} 1053}
@@ -1268,7 +1281,8 @@ struct xfrm6_tunnel {
1268 1281
1269extern void xfrm_init(void); 1282extern void xfrm_init(void);
1270extern void xfrm4_init(void); 1283extern void xfrm4_init(void);
1271extern void xfrm_state_init(void); 1284extern int xfrm_state_init(struct net *net);
1285extern void xfrm_state_fini(struct net *net);
1272extern void xfrm4_state_init(void); 1286extern void xfrm4_state_init(void);
1273#ifdef CONFIG_XFRM 1287#ifdef CONFIG_XFRM
1274extern int xfrm6_init(void); 1288extern int xfrm6_init(void);
@@ -1287,19 +1301,30 @@ static inline void xfrm6_fini(void)
1287#endif 1301#endif
1288 1302
1289#ifdef CONFIG_XFRM_STATISTICS 1303#ifdef CONFIG_XFRM_STATISTICS
1290extern int xfrm_proc_init(void); 1304extern int xfrm_proc_init(struct net *net);
1305extern void xfrm_proc_fini(struct net *net);
1306#endif
1307
1308extern int xfrm_sysctl_init(struct net *net);
1309#ifdef CONFIG_SYSCTL
1310extern void xfrm_sysctl_fini(struct net *net);
1311#else
1312static inline void xfrm_sysctl_fini(struct net *net)
1313{
1314}
1291#endif 1315#endif
1292 1316
1293extern void xfrm_state_walk_init(struct xfrm_state_walk *walk, u8 proto); 1317extern void xfrm_state_walk_init(struct xfrm_state_walk *walk, u8 proto);
1294extern int xfrm_state_walk(struct xfrm_state_walk *walk, 1318extern int xfrm_state_walk(struct net *net, struct xfrm_state_walk *walk,
1295 int (*func)(struct xfrm_state *, int, void*), void *); 1319 int (*func)(struct xfrm_state *, int, void*), void *);
1296extern void xfrm_state_walk_done(struct xfrm_state_walk *walk); 1320extern void xfrm_state_walk_done(struct xfrm_state_walk *walk);
1297extern struct xfrm_state *xfrm_state_alloc(void); 1321extern struct xfrm_state *xfrm_state_alloc(struct net *net);
1298extern struct xfrm_state *xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t *saddr, 1322extern struct xfrm_state *xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t *saddr,
1299 struct flowi *fl, struct xfrm_tmpl *tmpl, 1323 struct flowi *fl, struct xfrm_tmpl *tmpl,
1300 struct xfrm_policy *pol, int *err, 1324 struct xfrm_policy *pol, int *err,
1301 unsigned short family); 1325 unsigned short family);
1302extern struct xfrm_state * xfrm_stateonly_find(xfrm_address_t *daddr, 1326extern struct xfrm_state * xfrm_stateonly_find(struct net *net,
1327 xfrm_address_t *daddr,
1303 xfrm_address_t *saddr, 1328 xfrm_address_t *saddr,
1304 unsigned short family, 1329 unsigned short family,
1305 u8 mode, u8 proto, u32 reqid); 1330 u8 mode, u8 proto, u32 reqid);
@@ -1307,8 +1332,8 @@ extern int xfrm_state_check_expire(struct xfrm_state *x);
1307extern void xfrm_state_insert(struct xfrm_state *x); 1332extern void xfrm_state_insert(struct xfrm_state *x);
1308extern int xfrm_state_add(struct xfrm_state *x); 1333extern int xfrm_state_add(struct xfrm_state *x);
1309extern int xfrm_state_update(struct xfrm_state *x); 1334extern int xfrm_state_update(struct xfrm_state *x);
1310extern struct xfrm_state *xfrm_state_lookup(xfrm_address_t *daddr, __be32 spi, u8 proto, unsigned short family); 1335extern struct xfrm_state *xfrm_state_lookup(struct net *net, xfrm_address_t *daddr, __be32 spi, u8 proto, unsigned short family);
1311extern struct xfrm_state *xfrm_state_lookup_byaddr(xfrm_address_t *daddr, xfrm_address_t *saddr, u8 proto, unsigned short family); 1336extern struct xfrm_state *xfrm_state_lookup_byaddr(struct net *net, xfrm_address_t *daddr, xfrm_address_t *saddr, u8 proto, unsigned short family);
1312#ifdef CONFIG_XFRM_SUB_POLICY 1337#ifdef CONFIG_XFRM_SUB_POLICY
1313extern int xfrm_tmpl_sort(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, 1338extern int xfrm_tmpl_sort(struct xfrm_tmpl **dst, struct xfrm_tmpl **src,
1314 int n, unsigned short family); 1339 int n, unsigned short family);
@@ -1345,9 +1370,9 @@ struct xfrmk_spdinfo {
1345 u32 spdhmcnt; 1370 u32 spdhmcnt;
1346}; 1371};
1347 1372
1348extern struct xfrm_state *xfrm_find_acq_byseq(u32 seq); 1373extern struct xfrm_state *xfrm_find_acq_byseq(struct net *net, u32 seq);
1349extern int xfrm_state_delete(struct xfrm_state *x); 1374extern int xfrm_state_delete(struct xfrm_state *x);
1350extern int xfrm_state_flush(u8 proto, struct xfrm_audit *audit_info); 1375extern int xfrm_state_flush(struct net *net, u8 proto, struct xfrm_audit *audit_info);
1351extern void xfrm_sad_getinfo(struct xfrmk_sadinfo *si); 1376extern void xfrm_sad_getinfo(struct xfrmk_sadinfo *si);
1352extern void xfrm_spd_getinfo(struct xfrmk_spdinfo *si); 1377extern void xfrm_spd_getinfo(struct xfrmk_spdinfo *si);
1353extern int xfrm_replay_check(struct xfrm_state *x, 1378extern int xfrm_replay_check(struct xfrm_state *x,
@@ -1415,22 +1440,22 @@ static inline int xfrm4_udp_encap_rcv(struct sock *sk, struct sk_buff *skb)
1415} 1440}
1416#endif 1441#endif
1417 1442
1418struct xfrm_policy *xfrm_policy_alloc(gfp_t gfp); 1443struct xfrm_policy *xfrm_policy_alloc(struct net *net, gfp_t gfp);
1419 1444
1420extern void xfrm_policy_walk_init(struct xfrm_policy_walk *walk, u8 type); 1445extern void xfrm_policy_walk_init(struct xfrm_policy_walk *walk, u8 type);
1421extern int xfrm_policy_walk(struct xfrm_policy_walk *walk, 1446extern int xfrm_policy_walk(struct net *net, struct xfrm_policy_walk *walk,
1422 int (*func)(struct xfrm_policy *, int, int, void*), void *); 1447 int (*func)(struct xfrm_policy *, int, int, void*), void *);
1423extern void xfrm_policy_walk_done(struct xfrm_policy_walk *walk); 1448extern void xfrm_policy_walk_done(struct xfrm_policy_walk *walk);
1424int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl); 1449int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl);
1425struct xfrm_policy *xfrm_policy_bysel_ctx(u8 type, int dir, 1450struct xfrm_policy *xfrm_policy_bysel_ctx(struct net *net, u8 type, int dir,
1426 struct xfrm_selector *sel, 1451 struct xfrm_selector *sel,
1427 struct xfrm_sec_ctx *ctx, int delete, 1452 struct xfrm_sec_ctx *ctx, int delete,
1428 int *err); 1453 int *err);
1429struct xfrm_policy *xfrm_policy_byid(u8, int dir, u32 id, int delete, int *err); 1454struct xfrm_policy *xfrm_policy_byid(struct net *net, u8, int dir, u32 id, int delete, int *err);
1430int xfrm_policy_flush(u8 type, struct xfrm_audit *audit_info); 1455int xfrm_policy_flush(struct net *net, u8 type, struct xfrm_audit *audit_info);
1431u32 xfrm_get_acqseq(void); 1456u32 xfrm_get_acqseq(void);
1432extern int xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi); 1457extern int xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi);
1433struct xfrm_state * xfrm_find_acq(u8 mode, u32 reqid, u8 proto, 1458struct xfrm_state * xfrm_find_acq(struct net *net, u8 mode, u32 reqid, u8 proto,
1434 xfrm_address_t *daddr, xfrm_address_t *saddr, 1459 xfrm_address_t *daddr, xfrm_address_t *saddr,
1435 int create, unsigned short family); 1460 int create, unsigned short family);
1436extern int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol); 1461extern int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol);
@@ -1449,10 +1474,9 @@ extern int xfrm_migrate(struct xfrm_selector *sel, u8 dir, u8 type,
1449 struct xfrm_kmaddress *k); 1474 struct xfrm_kmaddress *k);
1450#endif 1475#endif
1451 1476
1452extern wait_queue_head_t km_waitq;
1453extern int km_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport); 1477extern int km_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport);
1454extern void km_policy_expired(struct xfrm_policy *pol, int dir, int hard, u32 pid); 1478extern void km_policy_expired(struct xfrm_policy *pol, int dir, int hard, u32 pid);
1455extern int km_report(u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr); 1479extern int km_report(struct net *net, u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr);
1456 1480
1457extern void xfrm_input_init(void); 1481extern void xfrm_input_init(void);
1458extern int xfrm_parse_spi(struct sk_buff *skb, u8 nexthdr, __be32 *spi, __be32 *seq); 1482extern int xfrm_parse_spi(struct sk_buff *skb, u8 nexthdr, __be32 *spi, __be32 *seq);
@@ -1497,18 +1521,20 @@ static inline int xfrm_policy_id2dir(u32 index)
1497 return index & 7; 1521 return index & 7;
1498} 1522}
1499 1523
1500static inline int xfrm_aevent_is_on(void) 1524#ifdef CONFIG_XFRM
1525static inline int xfrm_aevent_is_on(struct net *net)
1501{ 1526{
1502 struct sock *nlsk; 1527 struct sock *nlsk;
1503 int ret = 0; 1528 int ret = 0;
1504 1529
1505 rcu_read_lock(); 1530 rcu_read_lock();
1506 nlsk = rcu_dereference(xfrm_nl); 1531 nlsk = rcu_dereference(net->xfrm.nlsk);
1507 if (nlsk) 1532 if (nlsk)
1508 ret = netlink_has_listeners(nlsk, XFRMNLGRP_AEVENTS); 1533 ret = netlink_has_listeners(nlsk, XFRMNLGRP_AEVENTS);
1509 rcu_read_unlock(); 1534 rcu_read_unlock();
1510 return ret; 1535 return ret;
1511} 1536}
1537#endif
1512 1538
1513static inline int xfrm_alg_len(struct xfrm_algo *alg) 1539static inline int xfrm_alg_len(struct xfrm_algo *alg)
1514{ 1540{
@@ -1536,9 +1562,11 @@ static inline void xfrm_states_delete(struct xfrm_state **states, int n)
1536} 1562}
1537#endif 1563#endif
1538 1564
1565#ifdef CONFIG_XFRM
1539static inline struct xfrm_state *xfrm_input_state(struct sk_buff *skb) 1566static inline struct xfrm_state *xfrm_input_state(struct sk_buff *skb)
1540{ 1567{
1541 return skb->sp->xvec[skb->sp->len - 1]; 1568 return skb->sp->xvec[skb->sp->len - 1];
1542} 1569}
1570#endif
1543 1571
1544#endif /* _NET_XFRM_H */ 1572#endif /* _NET_XFRM_H */
diff --git a/include/scsi/fc/fc_els.h b/include/scsi/fc/fc_els.h
new file mode 100644
index 00000000000..195ca014d3c
--- /dev/null
+++ b/include/scsi/fc/fc_els.h
@@ -0,0 +1,816 @@
1/*
2 * Copyright(c) 2007 Intel Corporation. All rights reserved.
3 *
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,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
16 *
17 * Maintained at www.Open-FCoE.org
18 */
19
20#ifndef _FC_ELS_H_
21#define _FC_ELS_H_
22
23/*
24 * Fibre Channel Switch - Enhanced Link Services definitions.
25 * From T11 FC-LS Rev 1.2 June 7, 2005.
26 */
27
28/*
29 * ELS Command codes - byte 0 of the frame payload
30 */
31enum fc_els_cmd {
32 ELS_LS_RJT = 0x01, /* ESL reject */
33 ELS_LS_ACC = 0x02, /* ESL Accept */
34 ELS_PLOGI = 0x03, /* N_Port login */
35 ELS_FLOGI = 0x04, /* F_Port login */
36 ELS_LOGO = 0x05, /* Logout */
37 ELS_ABTX = 0x06, /* Abort exchange - obsolete */
38 ELS_RCS = 0x07, /* read connection status */
39 ELS_RES = 0x08, /* read exchange status block */
40 ELS_RSS = 0x09, /* read sequence status block */
41 ELS_RSI = 0x0a, /* read sequence initiative */
42 ELS_ESTS = 0x0b, /* establish streaming */
43 ELS_ESTC = 0x0c, /* estimate credit */
44 ELS_ADVC = 0x0d, /* advise credit */
45 ELS_RTV = 0x0e, /* read timeout value */
46 ELS_RLS = 0x0f, /* read link error status block */
47 ELS_ECHO = 0x10, /* echo */
48 ELS_TEST = 0x11, /* test */
49 ELS_RRQ = 0x12, /* reinstate recovery qualifier */
50 ELS_REC = 0x13, /* read exchange concise */
51 ELS_SRR = 0x14, /* sequence retransmission request */
52 ELS_PRLI = 0x20, /* process login */
53 ELS_PRLO = 0x21, /* process logout */
54 ELS_SCN = 0x22, /* state change notification */
55 ELS_TPLS = 0x23, /* test process login state */
56 ELS_TPRLO = 0x24, /* third party process logout */
57 ELS_LCLM = 0x25, /* login control list mgmt (obs) */
58 ELS_GAID = 0x30, /* get alias_ID */
59 ELS_FACT = 0x31, /* fabric activate alias_id */
60 ELS_FDACDT = 0x32, /* fabric deactivate alias_id */
61 ELS_NACT = 0x33, /* N-port activate alias_id */
62 ELS_NDACT = 0x34, /* N-port deactivate alias_id */
63 ELS_QOSR = 0x40, /* quality of service request */
64 ELS_RVCS = 0x41, /* read virtual circuit status */
65 ELS_PDISC = 0x50, /* discover N_port service params */
66 ELS_FDISC = 0x51, /* discover F_port service params */
67 ELS_ADISC = 0x52, /* discover address */
68 ELS_RNC = 0x53, /* report node cap (obs) */
69 ELS_FARP_REQ = 0x54, /* FC ARP request */
70 ELS_FARP_REPL = 0x55, /* FC ARP reply */
71 ELS_RPS = 0x56, /* read port status block */
72 ELS_RPL = 0x57, /* read port list */
73 ELS_RPBC = 0x58, /* read port buffer condition */
74 ELS_FAN = 0x60, /* fabric address notification */
75 ELS_RSCN = 0x61, /* registered state change notification */
76 ELS_SCR = 0x62, /* state change registration */
77 ELS_RNFT = 0x63, /* report node FC-4 types */
78 ELS_CSR = 0x68, /* clock synch. request */
79 ELS_CSU = 0x69, /* clock synch. update */
80 ELS_LINIT = 0x70, /* loop initialize */
81 ELS_LSTS = 0x72, /* loop status */
82 ELS_RNID = 0x78, /* request node ID data */
83 ELS_RLIR = 0x79, /* registered link incident report */
84 ELS_LIRR = 0x7a, /* link incident record registration */
85 ELS_SRL = 0x7b, /* scan remote loop */
86 ELS_SBRP = 0x7c, /* set bit-error reporting params */
87 ELS_RPSC = 0x7d, /* report speed capabilities */
88 ELS_QSA = 0x7e, /* query security attributes */
89 ELS_EVFP = 0x7f, /* exchange virt. fabrics params */
90 ELS_LKA = 0x80, /* link keep-alive */
91 ELS_AUTH_ELS = 0x90, /* authentication ELS */
92};
93
94/*
95 * Initializer useful for decoding table.
96 * Please keep this in sync with the above definitions.
97 */
98#define FC_ELS_CMDS_INIT { \
99 [ELS_LS_RJT] = "LS_RJT", \
100 [ELS_LS_ACC] = "LS_ACC", \
101 [ELS_PLOGI] = "PLOGI", \
102 [ELS_FLOGI] = "FLOGI", \
103 [ELS_LOGO] = "LOGO", \
104 [ELS_ABTX] = "ABTX", \
105 [ELS_RCS] = "RCS", \
106 [ELS_RES] = "RES", \
107 [ELS_RSS] = "RSS", \
108 [ELS_RSI] = "RSI", \
109 [ELS_ESTS] = "ESTS", \
110 [ELS_ESTC] = "ESTC", \
111 [ELS_ADVC] = "ADVC", \
112 [ELS_RTV] = "RTV", \
113 [ELS_RLS] = "RLS", \
114 [ELS_ECHO] = "ECHO", \
115 [ELS_TEST] = "TEST", \
116 [ELS_RRQ] = "RRQ", \
117 [ELS_REC] = "REC", \
118 [ELS_SRR] = "SRR", \
119 [ELS_PRLI] = "PRLI", \
120 [ELS_PRLO] = "PRLO", \
121 [ELS_SCN] = "SCN", \
122 [ELS_TPLS] = "TPLS", \
123 [ELS_TPRLO] = "TPRLO", \
124 [ELS_LCLM] = "LCLM", \
125 [ELS_GAID] = "GAID", \
126 [ELS_FACT] = "FACT", \
127 [ELS_FDACDT] = "FDACDT", \
128 [ELS_NACT] = "NACT", \
129 [ELS_NDACT] = "NDACT", \
130 [ELS_QOSR] = "QOSR", \
131 [ELS_RVCS] = "RVCS", \
132 [ELS_PDISC] = "PDISC", \
133 [ELS_FDISC] = "FDISC", \
134 [ELS_ADISC] = "ADISC", \
135 [ELS_RNC] = "RNC", \
136 [ELS_FARP_REQ] = "FARP_REQ", \
137 [ELS_FARP_REPL] = "FARP_REPL", \
138 [ELS_RPS] = "RPS", \
139 [ELS_RPL] = "RPL", \
140 [ELS_RPBC] = "RPBC", \
141 [ELS_FAN] = "FAN", \
142 [ELS_RSCN] = "RSCN", \
143 [ELS_SCR] = "SCR", \
144 [ELS_RNFT] = "RNFT", \
145 [ELS_CSR] = "CSR", \
146 [ELS_CSU] = "CSU", \
147 [ELS_LINIT] = "LINIT", \
148 [ELS_LSTS] = "LSTS", \
149 [ELS_RNID] = "RNID", \
150 [ELS_RLIR] = "RLIR", \
151 [ELS_LIRR] = "LIRR", \
152 [ELS_SRL] = "SRL", \
153 [ELS_SBRP] = "SBRP", \
154 [ELS_RPSC] = "RPSC", \
155 [ELS_QSA] = "QSA", \
156 [ELS_EVFP] = "EVFP", \
157 [ELS_LKA] = "LKA", \
158 [ELS_AUTH_ELS] = "AUTH_ELS", \
159}
160
161/*
162 * LS_ACC payload.
163 */
164struct fc_els_ls_acc {
165 __u8 la_cmd; /* command code ELS_LS_ACC */
166 __u8 la_resv[3]; /* reserved */
167};
168
169/*
170 * ELS reject payload.
171 */
172struct fc_els_ls_rjt {
173 __u8 er_cmd; /* command code ELS_LS_RJT */
174 __u8 er_resv[4]; /* reserved must be zero */
175 __u8 er_reason; /* reason (enum fc_els_rjt_reason below) */
176 __u8 er_explan; /* explanation (enum fc_els_rjt_explan below) */
177 __u8 er_vendor; /* vendor specific code */
178};
179
180/*
181 * ELS reject reason codes (er_reason).
182 */
183enum fc_els_rjt_reason {
184 ELS_RJT_NONE = 0, /* no reject - not to be sent */
185 ELS_RJT_INVAL = 0x01, /* invalid ELS command code */
186 ELS_RJT_LOGIC = 0x03, /* logical error */
187 ELS_RJT_BUSY = 0x05, /* logical busy */
188 ELS_RJT_PROT = 0x07, /* protocol error */
189 ELS_RJT_UNAB = 0x09, /* unable to perform command request */
190 ELS_RJT_UNSUP = 0x0b, /* command not supported */
191 ELS_RJT_INPROG = 0x0e, /* command already in progress */
192 ELS_RJT_VENDOR = 0xff, /* vendor specific error */
193};
194
195
196/*
197 * reason code explanation (er_explan).
198 */
199enum fc_els_rjt_explan {
200 ELS_EXPL_NONE = 0x00, /* No additional explanation */
201 ELS_EXPL_SPP_OPT_ERR = 0x01, /* service parameter error - options */
202 ELS_EXPL_SPP_ICTL_ERR = 0x03, /* service parm error - initiator ctl */
203 ELS_EXPL_AH = 0x11, /* invalid association header */
204 ELS_EXPL_AH_REQ = 0x13, /* association_header required */
205 ELS_EXPL_SID = 0x15, /* invalid originator S_ID */
206 ELS_EXPL_OXID_RXID = 0x17, /* invalid OX_ID-RX_ID combination */
207 ELS_EXPL_INPROG = 0x19, /* Request already in progress */
208 ELS_EXPL_PLOGI_REQD = 0x1e, /* N_Port login required */
209 ELS_EXPL_INSUF_RES = 0x29, /* insufficient resources */
210 ELS_EXPL_UNAB_DATA = 0x2a, /* unable to supply requested data */
211 ELS_EXPL_UNSUPR = 0x2c, /* Request not supported */
212 ELS_EXPL_INV_LEN = 0x2d, /* Invalid payload length */
213 /* TBD - above definitions incomplete */
214};
215
216/*
217 * Common service parameters (N ports).
218 */
219struct fc_els_csp {
220 __u8 sp_hi_ver; /* highest version supported (obs.) */
221 __u8 sp_lo_ver; /* highest version supported (obs.) */
222 __be16 sp_bb_cred; /* buffer-to-buffer credits */
223 __be16 sp_features; /* common feature flags */
224 __be16 sp_bb_data; /* b-b state number and data field sz */
225 union {
226 struct {
227 __be16 _sp_tot_seq; /* total concurrent sequences */
228 __be16 _sp_rel_off; /* rel. offset by info cat */
229 } sp_plogi;
230 struct {
231 __be32 _sp_r_a_tov; /* resource alloc. timeout msec */
232 } sp_flogi_acc;
233 } sp_u;
234 __be32 sp_e_d_tov; /* error detect timeout value */
235};
236#define sp_tot_seq sp_u.sp_plogi._sp_tot_seq
237#define sp_rel_off sp_u.sp_plogi._sp_rel_off
238#define sp_r_a_tov sp_u.sp_flogi_acc._sp_r_a_tov
239
240#define FC_SP_BB_DATA_MASK 0xfff /* mask for data field size in sp_bb_data */
241
242/*
243 * Minimum and maximum values for max data field size in service parameters.
244 */
245#define FC_SP_MIN_MAX_PAYLOAD FC_MIN_MAX_PAYLOAD
246#define FC_SP_MAX_MAX_PAYLOAD FC_MAX_PAYLOAD
247
248/*
249 * sp_features
250 */
251#define FC_SP_FT_CIRO 0x8000 /* continuously increasing rel. off. */
252#define FC_SP_FT_CLAD 0x8000 /* clean address (in FLOGI LS_ACC) */
253#define FC_SP_FT_RAND 0x4000 /* random relative offset */
254#define FC_SP_FT_VAL 0x2000 /* valid vendor version level */
255#define FC_SP_FT_FPORT 0x1000 /* F port (1) vs. N port (0) */
256#define FC_SP_FT_ABB 0x0800 /* alternate BB_credit management */
257#define FC_SP_FT_EDTR 0x0400 /* E_D_TOV Resolution is nanoseconds */
258#define FC_SP_FT_MCAST 0x0200 /* multicast */
259#define FC_SP_FT_BCAST 0x0100 /* broadcast */
260#define FC_SP_FT_HUNT 0x0080 /* hunt group */
261#define FC_SP_FT_SIMP 0x0040 /* dedicated simplex */
262#define FC_SP_FT_SEC 0x0020 /* reserved for security */
263#define FC_SP_FT_CSYN 0x0010 /* clock synch. supported */
264#define FC_SP_FT_RTTOV 0x0008 /* R_T_TOV value 100 uS, else 100 mS */
265#define FC_SP_FT_HALF 0x0004 /* dynamic half duplex */
266#define FC_SP_FT_SEQC 0x0002 /* SEQ_CNT */
267#define FC_SP_FT_PAYL 0x0001 /* FLOGI payload length 256, else 116 */
268
269/*
270 * Class-specific service parameters.
271 */
272struct fc_els_cssp {
273 __be16 cp_class; /* class flags */
274 __be16 cp_init; /* initiator flags */
275 __be16 cp_recip; /* recipient flags */
276 __be16 cp_rdfs; /* receive data field size */
277 __be16 cp_con_seq; /* concurrent sequences */
278 __be16 cp_ee_cred; /* N-port end-to-end credit */
279 __u8 cp_resv1; /* reserved */
280 __u8 cp_open_seq; /* open sequences per exchange */
281 __u8 _cp_resv2[2]; /* reserved */
282};
283
284/*
285 * cp_class flags.
286 */
287#define FC_CPC_VALID 0x8000 /* class valid */
288#define FC_CPC_IMIX 0x4000 /* intermix mode */
289#define FC_CPC_SEQ 0x0800 /* sequential delivery */
290#define FC_CPC_CAMP 0x0200 /* camp-on */
291#define FC_CPC_PRI 0x0080 /* priority */
292
293/*
294 * cp_init flags.
295 * (TBD: not all flags defined here).
296 */
297#define FC_CPI_CSYN 0x0010 /* clock synch. capable */
298
299/*
300 * cp_recip flags.
301 */
302#define FC_CPR_CSYN 0x0008 /* clock synch. capable */
303
304/*
305 * NFC_ELS_FLOGI: Fabric login request.
306 * NFC_ELS_PLOGI: Port login request (same format).
307 */
308struct fc_els_flogi {
309 __u8 fl_cmd; /* command */
310 __u8 _fl_resvd[3]; /* must be zero */
311 struct fc_els_csp fl_csp; /* common service parameters */
312 __be64 fl_wwpn; /* port name */
313 __be64 fl_wwnn; /* node name */
314 struct fc_els_cssp fl_cssp[4]; /* class 1-4 service parameters */
315 __u8 fl_vend[16]; /* vendor version level */
316} __attribute__((__packed__));
317
318/*
319 * Process login service parameter page.
320 */
321struct fc_els_spp {
322 __u8 spp_type; /* type code or common service params */
323 __u8 spp_type_ext; /* type code extension */
324 __u8 spp_flags;
325 __u8 _spp_resvd;
326 __be32 spp_orig_pa; /* originator process associator */
327 __be32 spp_resp_pa; /* responder process associator */
328 __be32 spp_params; /* service parameters */
329};
330
331/*
332 * spp_flags.
333 */
334#define FC_SPP_OPA_VAL 0x80 /* originator proc. assoc. valid */
335#define FC_SPP_RPA_VAL 0x40 /* responder proc. assoc. valid */
336#define FC_SPP_EST_IMG_PAIR 0x20 /* establish image pair */
337#define FC_SPP_RESP_MASK 0x0f /* mask for response code (below) */
338
339/*
340 * SPP response code in spp_flags - lower 4 bits.
341 */
342enum fc_els_spp_resp {
343 FC_SPP_RESP_ACK = 1, /* request executed */
344 FC_SPP_RESP_RES = 2, /* unable due to lack of resources */
345 FC_SPP_RESP_INIT = 3, /* initialization not complete */
346 FC_SPP_RESP_NO_PA = 4, /* unknown process associator */
347 FC_SPP_RESP_CONF = 5, /* configuration precludes image pair */
348 FC_SPP_RESP_COND = 6, /* request completed conditionally */
349 FC_SPP_RESP_MULT = 7, /* unable to handle multiple SPPs */
350 FC_SPP_RESP_INVL = 8, /* SPP is invalid */
351};
352
353/*
354 * ELS_RRQ - Reinstate Recovery Qualifier
355 */
356struct fc_els_rrq {
357 __u8 rrq_cmd; /* command (0x12) */
358 __u8 rrq_zero[3]; /* specified as zero - part of cmd */
359 __u8 rrq_resvd; /* reserved */
360 __u8 rrq_s_id[3]; /* originator FID */
361 __be16 rrq_ox_id; /* originator exchange ID */
362 __be16 rrq_rx_id; /* responders exchange ID */
363};
364
365/*
366 * ELS_REC - Read exchange concise.
367 */
368struct fc_els_rec {
369 __u8 rec_cmd; /* command (0x13) */
370 __u8 rec_zero[3]; /* specified as zero - part of cmd */
371 __u8 rec_resvd; /* reserved */
372 __u8 rec_s_id[3]; /* originator FID */
373 __be16 rec_ox_id; /* originator exchange ID */
374 __be16 rec_rx_id; /* responders exchange ID */
375};
376
377/*
378 * ELS_REC LS_ACC payload.
379 */
380struct fc_els_rec_acc {
381 __u8 reca_cmd; /* accept (0x02) */
382 __u8 reca_zero[3]; /* specified as zero - part of cmd */
383 __be16 reca_ox_id; /* originator exchange ID */
384 __be16 reca_rx_id; /* responders exchange ID */
385 __u8 reca_resvd1; /* reserved */
386 __u8 reca_ofid[3]; /* originator FID */
387 __u8 reca_resvd2; /* reserved */
388 __u8 reca_rfid[3]; /* responder FID */
389 __be32 reca_fc4value; /* FC4 value */
390 __be32 reca_e_stat; /* ESB (exchange status block) status */
391};
392
393/*
394 * ELS_PRLI - Process login request and response.
395 */
396struct fc_els_prli {
397 __u8 prli_cmd; /* command */
398 __u8 prli_spp_len; /* length of each serv. parm. page */
399 __be16 prli_len; /* length of entire payload */
400 /* service parameter pages follow */
401};
402
403/*
404 * ELS_ADISC payload
405 */
406struct fc_els_adisc {
407 __u8 adisc_cmd;
408 __u8 adisc_resv[3];
409 __u8 adisc_resv1;
410 __u8 adisc_hard_addr[3];
411 __be64 adisc_wwpn;
412 __be64 adisc_wwnn;
413 __u8 adisc_resv2;
414 __u8 adisc_port_id[3];
415} __attribute__((__packed__));
416
417/*
418 * ELS_LOGO - process or fabric logout.
419 */
420struct fc_els_logo {
421 __u8 fl_cmd; /* command code */
422 __u8 fl_zero[3]; /* specified as zero - part of cmd */
423 __u8 fl_resvd; /* reserved */
424 __u8 fl_n_port_id[3];/* N port ID */
425 __be64 fl_n_port_wwn; /* port name */
426};
427
428/*
429 * ELS_RTV - read timeout value.
430 */
431struct fc_els_rtv {
432 __u8 rtv_cmd; /* command code 0x0e */
433 __u8 rtv_zero[3]; /* specified as zero - part of cmd */
434};
435
436/*
437 * LS_ACC for ELS_RTV - read timeout value.
438 */
439struct fc_els_rtv_acc {
440 __u8 rtv_cmd; /* command code 0x02 */
441 __u8 rtv_zero[3]; /* specified as zero - part of cmd */
442 __be32 rtv_r_a_tov; /* resource allocation timeout value */
443 __be32 rtv_e_d_tov; /* error detection timeout value */
444 __be32 rtv_toq; /* timeout qualifier (see below) */
445};
446
447/*
448 * rtv_toq bits.
449 */
450#define FC_ELS_RTV_EDRES (1 << 26) /* E_D_TOV resolution is nS else mS */
451#define FC_ELS_RTV_RTTOV (1 << 19) /* R_T_TOV is 100 uS else 100 mS */
452
453/*
454 * ELS_SCR - state change registration payload.
455 */
456struct fc_els_scr {
457 __u8 scr_cmd; /* command code */
458 __u8 scr_resv[6]; /* reserved */
459 __u8 scr_reg_func; /* registration function (see below) */
460};
461
462enum fc_els_scr_func {
463 ELS_SCRF_FAB = 1, /* fabric-detected registration */
464 ELS_SCRF_NPORT = 2, /* Nx_Port-detected registration */
465 ELS_SCRF_FULL = 3, /* full registration */
466 ELS_SCRF_CLEAR = 255, /* remove any current registrations */
467};
468
469/*
470 * ELS_RSCN - registered state change notification payload.
471 */
472struct fc_els_rscn {
473 __u8 rscn_cmd; /* RSCN opcode (0x61) */
474 __u8 rscn_page_len; /* page length (4) */
475 __be16 rscn_plen; /* payload length including this word */
476
477 /* followed by 4-byte generic affected Port_ID pages */
478};
479
480struct fc_els_rscn_page {
481 __u8 rscn_page_flags; /* event and address format */
482 __u8 rscn_fid[3]; /* fabric ID */
483};
484
485#define ELS_RSCN_EV_QUAL_BIT 2 /* shift count for event qualifier */
486#define ELS_RSCN_EV_QUAL_MASK 0xf /* mask for event qualifier */
487#define ELS_RSCN_ADDR_FMT_BIT 0 /* shift count for address format */
488#define ELS_RSCN_ADDR_FMT_MASK 0x3 /* mask for address format */
489
490enum fc_els_rscn_ev_qual {
491 ELS_EV_QUAL_NONE = 0, /* unspecified */
492 ELS_EV_QUAL_NS_OBJ = 1, /* changed name server object */
493 ELS_EV_QUAL_PORT_ATTR = 2, /* changed port attribute */
494 ELS_EV_QUAL_SERV_OBJ = 3, /* changed service object */
495 ELS_EV_QUAL_SW_CONFIG = 4, /* changed switch configuration */
496 ELS_EV_QUAL_REM_OBJ = 5, /* removed object */
497};
498
499enum fc_els_rscn_addr_fmt {
500 ELS_ADDR_FMT_PORT = 0, /* rscn_fid is a port address */
501 ELS_ADDR_FMT_AREA = 1, /* rscn_fid is a area address */
502 ELS_ADDR_FMT_DOM = 2, /* rscn_fid is a domain address */
503 ELS_ADDR_FMT_FAB = 3, /* anything on fabric may have changed */
504};
505
506/*
507 * ELS_RNID - request Node ID.
508 */
509struct fc_els_rnid {
510 __u8 rnid_cmd; /* RNID opcode (0x78) */
511 __u8 rnid_resv[3]; /* reserved */
512 __u8 rnid_fmt; /* data format */
513 __u8 rnid_resv2[3]; /* reserved */
514};
515
516/*
517 * Node Identification Data formats (rnid_fmt)
518 */
519enum fc_els_rnid_fmt {
520 ELS_RNIDF_NONE = 0, /* no specific identification data */
521 ELS_RNIDF_GEN = 0xdf, /* general topology discovery format */
522};
523
524/*
525 * ELS_RNID response.
526 */
527struct fc_els_rnid_resp {
528 __u8 rnid_cmd; /* response code (LS_ACC) */
529 __u8 rnid_resv[3]; /* reserved */
530 __u8 rnid_fmt; /* data format */
531 __u8 rnid_cid_len; /* common ID data length */
532 __u8 rnid_resv2; /* reserved */
533 __u8 rnid_sid_len; /* specific ID data length */
534};
535
536struct fc_els_rnid_cid {
537 __be64 rnid_wwpn; /* N port name */
538 __be64 rnid_wwnn; /* node name */
539};
540
541struct fc_els_rnid_gen {
542 __u8 rnid_vend_id[16]; /* vendor-unique ID */
543 __be32 rnid_atype; /* associated type (see below) */
544 __be32 rnid_phys_port; /* physical port number */
545 __be32 rnid_att_nodes; /* number of attached nodes */
546 __u8 rnid_node_mgmt; /* node management (see below) */
547 __u8 rnid_ip_ver; /* IP version (see below) */
548 __be16 rnid_prot_port; /* UDP / TCP port number */
549 __be32 rnid_ip_addr[4]; /* IP address */
550 __u8 rnid_resvd[2]; /* reserved */
551 __be16 rnid_vend_spec; /* vendor-specific field */
552};
553
554enum fc_els_rnid_atype {
555 ELS_RNIDA_UNK = 0x01, /* unknown */
556 ELS_RNIDA_OTHER = 0x02, /* none of the following */
557 ELS_RNIDA_HUB = 0x03,
558 ELS_RNIDA_SWITCH = 0x04,
559 ELS_RNIDA_GATEWAY = 0x05,
560 ELS_RNIDA_CONV = 0x06, /* Obsolete, do not use this value */
561 ELS_RNIDA_HBA = 0x07, /* Obsolete, do not use this value */
562 ELS_RNIDA_PROXY = 0x08, /* Obsolete, do not use this value */
563 ELS_RNIDA_STORAGE = 0x09,
564 ELS_RNIDA_HOST = 0x0a,
565 ELS_RNIDA_SUBSYS = 0x0b, /* storage subsystem (e.g., RAID) */
566 ELS_RNIDA_ACCESS = 0x0e, /* access device (e.g. media changer) */
567 ELS_RNIDA_NAS = 0x11, /* NAS server */
568 ELS_RNIDA_BRIDGE = 0x12, /* bridge */
569 ELS_RNIDA_VIRT = 0x13, /* virtualization device */
570 ELS_RNIDA_MF = 0xff, /* multifunction device (bits below) */
571 ELS_RNIDA_MF_HUB = 1UL << 31, /* hub */
572 ELS_RNIDA_MF_SW = 1UL << 30, /* switch */
573 ELS_RNIDA_MF_GW = 1UL << 29, /* gateway */
574 ELS_RNIDA_MF_ST = 1UL << 28, /* storage */
575 ELS_RNIDA_MF_HOST = 1UL << 27, /* host */
576 ELS_RNIDA_MF_SUB = 1UL << 26, /* storage subsystem */
577 ELS_RNIDA_MF_ACC = 1UL << 25, /* storage access dev */
578 ELS_RNIDA_MF_WDM = 1UL << 24, /* wavelength division mux */
579 ELS_RNIDA_MF_NAS = 1UL << 23, /* NAS server */
580 ELS_RNIDA_MF_BR = 1UL << 22, /* bridge */
581 ELS_RNIDA_MF_VIRT = 1UL << 21, /* virtualization device */
582};
583
584enum fc_els_rnid_mgmt {
585 ELS_RNIDM_SNMP = 0,
586 ELS_RNIDM_TELNET = 1,
587 ELS_RNIDM_HTTP = 2,
588 ELS_RNIDM_HTTPS = 3,
589 ELS_RNIDM_XML = 4, /* HTTP + XML */
590};
591
592enum fc_els_rnid_ipver {
593 ELS_RNIDIP_NONE = 0, /* no IP support or node mgmt. */
594 ELS_RNIDIP_V4 = 1, /* IPv4 */
595 ELS_RNIDIP_V6 = 2, /* IPv6 */
596};
597
598/*
599 * ELS RPL - Read Port List.
600 */
601struct fc_els_rpl {
602 __u8 rpl_cmd; /* command */
603 __u8 rpl_resv[5]; /* reserved - must be zero */
604 __be16 rpl_max_size; /* maximum response size or zero */
605 __u8 rpl_resv1; /* reserved - must be zero */
606 __u8 rpl_index[3]; /* starting index */
607};
608
609/*
610 * Port number block in RPL response.
611 */
612struct fc_els_pnb {
613 __be32 pnb_phys_pn; /* physical port number */
614 __u8 pnb_resv; /* reserved */
615 __u8 pnb_port_id[3]; /* port ID */
616 __be64 pnb_wwpn; /* port name */
617};
618
619/*
620 * RPL LS_ACC response.
621 */
622struct fc_els_rpl_resp {
623 __u8 rpl_cmd; /* ELS_LS_ACC */
624 __u8 rpl_resv1; /* reserved - must be zero */
625 __be16 rpl_plen; /* payload length */
626 __u8 rpl_resv2; /* reserved - must be zero */
627 __u8 rpl_llen[3]; /* list length */
628 __u8 rpl_resv3; /* reserved - must be zero */
629 __u8 rpl_index[3]; /* starting index */
630 struct fc_els_pnb rpl_pnb[1]; /* variable number of PNBs */
631};
632
633/*
634 * Link Error Status Block.
635 */
636struct fc_els_lesb {
637 __be32 lesb_link_fail; /* link failure count */
638 __be32 lesb_sync_loss; /* loss of synchronization count */
639 __be32 lesb_sig_loss; /* loss of signal count */
640 __be32 lesb_prim_err; /* primitive sequence error count */
641 __be32 lesb_inv_word; /* invalid transmission word count */
642 __be32 lesb_inv_crc; /* invalid CRC count */
643};
644
645/*
646 * ELS RPS - Read Port Status Block request.
647 */
648struct fc_els_rps {
649 __u8 rps_cmd; /* command */
650 __u8 rps_resv[2]; /* reserved - must be zero */
651 __u8 rps_flag; /* flag - see below */
652 __be64 rps_port_spec; /* port selection */
653};
654
655enum fc_els_rps_flag {
656 FC_ELS_RPS_DID = 0x00, /* port identified by D_ID of req. */
657 FC_ELS_RPS_PPN = 0x01, /* port_spec is physical port number */
658 FC_ELS_RPS_WWPN = 0x02, /* port_spec is port WWN */
659};
660
661/*
662 * ELS RPS LS_ACC response.
663 */
664struct fc_els_rps_resp {
665 __u8 rps_cmd; /* command - LS_ACC */
666 __u8 rps_resv[2]; /* reserved - must be zero */
667 __u8 rps_flag; /* flag - see below */
668 __u8 rps_resv2[2]; /* reserved */
669 __be16 rps_status; /* port status - see below */
670 struct fc_els_lesb rps_lesb; /* link error status block */
671};
672
673enum fc_els_rps_resp_flag {
674 FC_ELS_RPS_LPEV = 0x01, /* L_port extension valid */
675};
676
677enum fc_els_rps_resp_status {
678 FC_ELS_RPS_PTP = 1 << 5, /* point-to-point connection */
679 FC_ELS_RPS_LOOP = 1 << 4, /* loop mode */
680 FC_ELS_RPS_FAB = 1 << 3, /* fabric present */
681 FC_ELS_RPS_NO_SIG = 1 << 2, /* loss of signal */
682 FC_ELS_RPS_NO_SYNC = 1 << 1, /* loss of synchronization */
683 FC_ELS_RPS_RESET = 1 << 0, /* in link reset protocol */
684};
685
686/*
687 * ELS LIRR - Link Incident Record Registration request.
688 */
689struct fc_els_lirr {
690 __u8 lirr_cmd; /* command */
691 __u8 lirr_resv[3]; /* reserved - must be zero */
692 __u8 lirr_func; /* registration function */
693 __u8 lirr_fmt; /* FC-4 type of RLIR requested */
694 __u8 lirr_resv2[2]; /* reserved - must be zero */
695};
696
697enum fc_els_lirr_func {
698 ELS_LIRR_SET_COND = 0x01, /* set - conditionally receive */
699 ELS_LIRR_SET_UNCOND = 0x02, /* set - unconditionally receive */
700 ELS_LIRR_CLEAR = 0xff /* clear registration */
701};
702
703/*
704 * ELS SRL - Scan Remote Loop request.
705 */
706struct fc_els_srl {
707 __u8 srl_cmd; /* command */
708 __u8 srl_resv[3]; /* reserved - must be zero */
709 __u8 srl_flag; /* flag - see below */
710 __u8 srl_flag_param[3]; /* flag parameter */
711};
712
713enum fc_els_srl_flag {
714 FC_ELS_SRL_ALL = 0x00, /* scan all FL ports */
715 FC_ELS_SRL_ONE = 0x01, /* scan specified loop */
716 FC_ELS_SRL_EN_PER = 0x02, /* enable periodic scanning (param) */
717 FC_ELS_SRL_DIS_PER = 0x03, /* disable periodic scanning */
718};
719
720/*
721 * ELS RLS - Read Link Error Status Block request.
722 */
723struct fc_els_rls {
724 __u8 rls_cmd; /* command */
725 __u8 rls_resv[4]; /* reserved - must be zero */
726 __u8 rls_port_id[3]; /* port ID */
727};
728
729/*
730 * ELS RLS LS_ACC Response.
731 */
732struct fc_els_rls_resp {
733 __u8 rls_cmd; /* ELS_LS_ACC */
734 __u8 rls_resv[3]; /* reserved - must be zero */
735 struct fc_els_lesb rls_lesb; /* link error status block */
736};
737
738/*
739 * ELS RLIR - Registered Link Incident Report.
740 * This is followed by the CLIR and the CLID, described below.
741 */
742struct fc_els_rlir {
743 __u8 rlir_cmd; /* command */
744 __u8 rlir_resv[3]; /* reserved - must be zero */
745 __u8 rlir_fmt; /* format (FC4-type if type specific) */
746 __u8 rlir_clr_len; /* common link incident record length */
747 __u8 rlir_cld_len; /* common link incident desc. length */
748 __u8 rlir_slr_len; /* spec. link incident record length */
749};
750
751/*
752 * CLIR - Common Link Incident Record Data. - Sent via RLIR.
753 */
754struct fc_els_clir {
755 __be64 clir_wwpn; /* incident port name */
756 __be64 clir_wwnn; /* incident port node name */
757 __u8 clir_port_type; /* incident port type */
758 __u8 clir_port_id[3]; /* incident port ID */
759
760 __be64 clir_conn_wwpn; /* connected port name */
761 __be64 clir_conn_wwnn; /* connected node name */
762 __be64 clir_fab_name; /* fabric name */
763 __be32 clir_phys_port; /* physical port number */
764 __be32 clir_trans_id; /* transaction ID */
765 __u8 clir_resv[3]; /* reserved */
766 __u8 clir_ts_fmt; /* time stamp format */
767 __be64 clir_timestamp; /* time stamp */
768};
769
770/*
771 * CLIR clir_ts_fmt - time stamp format values.
772 */
773enum fc_els_clir_ts_fmt {
774 ELS_CLIR_TS_UNKNOWN = 0, /* time stamp field unknown */
775 ELS_CLIR_TS_SEC_FRAC = 1, /* time in seconds and fractions */
776 ELS_CLIR_TS_CSU = 2, /* time in clock synch update format */
777};
778
779/*
780 * Common Link Incident Descriptor - sent via RLIR.
781 */
782struct fc_els_clid {
783 __u8 clid_iq; /* incident qualifier flags */
784 __u8 clid_ic; /* incident code */
785 __be16 clid_epai; /* domain/area of ISL */
786};
787
788/*
789 * CLID incident qualifier flags.
790 */
791enum fc_els_clid_iq {
792 ELS_CLID_SWITCH = 0x20, /* incident port is a switch node */
793 ELS_CLID_E_PORT = 0x10, /* incident is an ISL (E) port */
794 ELS_CLID_SEV_MASK = 0x0c, /* severity 2-bit field mask */
795 ELS_CLID_SEV_INFO = 0x00, /* report is informational */
796 ELS_CLID_SEV_INOP = 0x08, /* link not operational */
797 ELS_CLID_SEV_DEG = 0x04, /* link degraded but operational */
798 ELS_CLID_LASER = 0x02, /* subassembly is a laser */
799 ELS_CLID_FRU = 0x01, /* format can identify a FRU */
800};
801
802/*
803 * CLID incident code.
804 */
805enum fc_els_clid_ic {
806 ELS_CLID_IC_IMPL = 1, /* implicit incident */
807 ELS_CLID_IC_BER = 2, /* bit-error-rate threshold exceeded */
808 ELS_CLID_IC_LOS = 3, /* loss of synch or signal */
809 ELS_CLID_IC_NOS = 4, /* non-operational primitive sequence */
810 ELS_CLID_IC_PST = 5, /* primitive sequence timeout */
811 ELS_CLID_IC_INVAL = 6, /* invalid primitive sequence */
812 ELS_CLID_IC_LOOP_TO = 7, /* loop initialization time out */
813 ELS_CLID_IC_LIP = 8, /* receiving LIP */
814};
815
816#endif /* _FC_ELS_H_ */
diff --git a/include/scsi/fc/fc_encaps.h b/include/scsi/fc/fc_encaps.h
new file mode 100644
index 00000000000..f180c3e1622
--- /dev/null
+++ b/include/scsi/fc/fc_encaps.h
@@ -0,0 +1,138 @@
1/*
2 * Copyright(c) 2007 Intel Corporation. All rights reserved.
3 *
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,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
16 *
17 * Maintained at www.Open-FCoE.org
18 */
19#ifndef _FC_ENCAPS_H_
20#define _FC_ENCAPS_H_
21
22/*
23 * Protocol definitions from RFC 3643 - Fibre Channel Frame Encapsulation.
24 *
25 * Note: The frame length field is the number of 32-bit words in
26 * the encapsulation including the fcip_encaps_header, CRC and EOF words.
27 * The minimum frame length value in bytes is (32 + 24 + 4 + 4) * 4 = 64.
28 * The maximum frame length value in bytes is (32 + 24 + 2112 + 4 + 4) = 2172.
29 */
30#define FC_ENCAPS_MIN_FRAME_LEN 64 /* min frame len (bytes) (see above) */
31#define FC_ENCAPS_MAX_FRAME_LEN (FC_ENCAPS_MIN_FRAME_LEN + FC_MAX_PAYLOAD)
32
33#define FC_ENCAPS_VER 1 /* current version number */
34
35struct fc_encaps_hdr {
36 __u8 fc_proto; /* protocol number */
37 __u8 fc_ver; /* version of encapsulation */
38 __u8 fc_proto_n; /* ones complement of protocol */
39 __u8 fc_ver_n; /* ones complement of version */
40
41 unsigned char fc_proto_data[8]; /* protocol specific data */
42
43 __be16 fc_len_flags; /* 10-bit length/4 w/ 6 flag bits */
44 __be16 fc_len_flags_n; /* ones complement of length / flags */
45
46 /*
47 * Offset 0x10
48 */
49 __be32 fc_time[2]; /* time stamp: seconds and fraction */
50 __be32 fc_crc; /* CRC */
51 __be32 fc_sof; /* start of frame (see FC_SOF below) */
52
53 /* 0x20 - FC frame content followed by EOF word */
54};
55
56#define FCIP_ENCAPS_HDR_LEN 0x20 /* expected length for asserts */
57
58/*
59 * Macro's for making redundant copies of EOF and SOF.
60 */
61#define FC_XY(x, y) ((((x) & 0xff) << 8) | ((y) & 0xff))
62#define FC_XYXY(x, y) ((FCIP_XY(x, y) << 16) | FCIP_XY(x, y))
63#define FC_XYNN(x, y) (FCIP_XYXY(x, y) ^ 0xffff)
64
65#define FC_SOF_ENCODE(n) FC_XYNN(n, n)
66#define FC_EOF_ENCODE(n) FC_XYNN(n, n)
67
68/*
69 * SOF / EOF bytes.
70 */
71enum fc_sof {
72 FC_SOF_F = 0x28, /* fabric */
73 FC_SOF_I4 = 0x29, /* initiate class 4 */
74 FC_SOF_I2 = 0x2d, /* initiate class 2 */
75 FC_SOF_I3 = 0x2e, /* initiate class 3 */
76 FC_SOF_N4 = 0x31, /* normal class 4 */
77 FC_SOF_N2 = 0x35, /* normal class 2 */
78 FC_SOF_N3 = 0x36, /* normal class 3 */
79 FC_SOF_C4 = 0x39, /* activate class 4 */
80} __attribute__((packed));
81
82enum fc_eof {
83 FC_EOF_N = 0x41, /* normal (not last frame of seq) */
84 FC_EOF_T = 0x42, /* terminate (last frame of sequence) */
85 FC_EOF_RT = 0x44,
86 FC_EOF_DT = 0x46, /* disconnect-terminate class-1 */
87 FC_EOF_NI = 0x49, /* normal-invalid */
88 FC_EOF_DTI = 0x4e, /* disconnect-terminate-invalid */
89 FC_EOF_RTI = 0x4f,
90 FC_EOF_A = 0x50, /* abort */
91} __attribute__((packed));
92
93#define FC_SOF_CLASS_MASK 0x06 /* mask for class of service in SOF */
94
95/*
96 * Define classes in terms of the SOF code (initial).
97 */
98enum fc_class {
99 FC_CLASS_NONE = 0, /* software value indicating no class */
100 FC_CLASS_2 = FC_SOF_I2,
101 FC_CLASS_3 = FC_SOF_I3,
102 FC_CLASS_4 = FC_SOF_I4,
103 FC_CLASS_F = FC_SOF_F,
104};
105
106/*
107 * Determine whether SOF code indicates the need for a BLS ACK.
108 */
109static inline int fc_sof_needs_ack(enum fc_sof sof)
110{
111 return (~sof) & 0x02; /* true for class 1, 2, 4, 6, or F */
112}
113
114/*
115 * Given an fc_class, return the normal (non-initial) SOF value.
116 */
117static inline enum fc_sof fc_sof_normal(enum fc_class class)
118{
119 return class + FC_SOF_N3 - FC_SOF_I3; /* diff is always 8 */
120}
121
122/*
123 * Compute class from SOF value.
124 */
125static inline enum fc_class fc_sof_class(enum fc_sof sof)
126{
127 return (sof & 0x7) | FC_SOF_F;
128}
129
130/*
131 * Determine whether SOF is for the initial frame of a sequence.
132 */
133static inline int fc_sof_is_init(enum fc_sof sof)
134{
135 return sof < 0x30;
136}
137
138#endif /* _FC_ENCAPS_H_ */
diff --git a/include/scsi/fc/fc_fc2.h b/include/scsi/fc/fc_fc2.h
new file mode 100644
index 00000000000..cff8a8c22f5
--- /dev/null
+++ b/include/scsi/fc/fc_fc2.h
@@ -0,0 +1,124 @@
1/*
2 * Copyright(c) 2007 Intel Corporation. All rights reserved.
3 *
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,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
16 *
17 * Maintained at www.Open-FCoE.org
18 */
19
20#ifndef _FC_FC2_H_
21#define _FC_FC2_H_
22
23/*
24 * Fibre Channel Exchanges and Sequences.
25 */
26#ifndef PACKED
27#define PACKED __attribute__ ((__packed__))
28#endif /* PACKED */
29
30
31/*
32 * Sequence Status Block.
33 * This format is set by the FC-FS standard and is sent over the wire.
34 * Note that the fields aren't all naturally aligned.
35 */
36struct fc_ssb {
37 __u8 ssb_seq_id; /* sequence ID */
38 __u8 _ssb_resvd;
39 __be16 ssb_low_seq_cnt; /* lowest SEQ_CNT */
40
41 __be16 ssb_high_seq_cnt; /* highest SEQ_CNT */
42 __be16 ssb_s_stat; /* sequence status flags */
43
44 __be16 ssb_err_seq_cnt; /* error SEQ_CNT */
45 __u8 ssb_fh_cs_ctl; /* frame header CS_CTL */
46 __be16 ssb_fh_ox_id; /* frame header OX_ID */
47 __be16 ssb_rx_id; /* responder's exchange ID */
48 __u8 _ssb_resvd2[2];
49} PACKED;
50
51/*
52 * The SSB should be 17 bytes. Since it's layout is somewhat strange,
53 * we define the size here so that code can ASSERT that the size comes out
54 * correct.
55 */
56#define FC_SSB_SIZE 17 /* length of fc_ssb for assert */
57
58/*
59 * ssb_s_stat - flags from FC-FS-2 T11/1619-D Rev 0.90.
60 */
61#define SSB_ST_RESP (1 << 15) /* sequence responder */
62#define SSB_ST_ACTIVE (1 << 14) /* sequence is active */
63#define SSB_ST_ABNORMAL (1 << 12) /* abnormal ending condition */
64
65#define SSB_ST_REQ_MASK (3 << 10) /* ACK, abort sequence condition */
66#define SSB_ST_REQ_CONT (0 << 10)
67#define SSB_ST_REQ_ABORT (1 << 10)
68#define SSB_ST_REQ_STOP (2 << 10)
69#define SSB_ST_REQ_RETRANS (3 << 10)
70
71#define SSB_ST_ABTS (1 << 9) /* ABTS protocol completed */
72#define SSB_ST_RETRANS (1 << 8) /* retransmission completed */
73#define SSB_ST_TIMEOUT (1 << 7) /* sequence timed out by recipient */
74#define SSB_ST_P_RJT (1 << 6) /* P_RJT transmitted */
75
76#define SSB_ST_CLASS_BIT 4 /* class of service field LSB */
77#define SSB_ST_CLASS_MASK 3 /* class of service mask */
78#define SSB_ST_ACK (1 << 3) /* ACK (EOFt or EOFdt) transmitted */
79
80/*
81 * Exchange Status Block.
82 * This format is set by the FC-FS standard and is sent over the wire.
83 * Note that the fields aren't all naturally aligned.
84 */
85struct fc_esb {
86 __u8 esb_cs_ctl; /* CS_CTL for frame header */
87 __be16 esb_ox_id; /* originator exchange ID */
88 __be16 esb_rx_id; /* responder exchange ID */
89 __be32 esb_orig_fid; /* fabric ID of originator */
90 __be32 esb_resp_fid; /* fabric ID of responder */
91 __be32 esb_e_stat; /* status */
92 __u8 _esb_resvd[4];
93 __u8 esb_service_params[112]; /* TBD */
94 __u8 esb_seq_status[8]; /* sequence statuses, 8 bytes each */
95} __attribute__((packed));;
96
97
98/*
99 * Define expected size for ASSERTs.
100 * See comments on FC_SSB_SIZE.
101 */
102#define FC_ESB_SIZE (1 + 5*4 + 112 + 8) /* expected size */
103
104/*
105 * esb_e_stat - flags from FC-FS-2 T11/1619-D Rev 0.90.
106 */
107#define ESB_ST_RESP (1 << 31) /* responder to exchange */
108#define ESB_ST_SEQ_INIT (1 << 30) /* port holds sequence initiaive */
109#define ESB_ST_COMPLETE (1 << 29) /* exchange is complete */
110#define ESB_ST_ABNORMAL (1 << 28) /* abnormal ending condition */
111#define ESB_ST_REC_QUAL (1 << 26) /* recovery qualifier active */
112
113#define ESB_ST_ERRP_BIT 24 /* LSB for error policy */
114#define ESB_ST_ERRP_MASK (3 << 24) /* mask for error policy */
115#define ESB_ST_ERRP_MULT (0 << 24) /* abort, discard multiple sequences */
116#define ESB_ST_ERRP_SING (1 << 24) /* abort, discard single sequence */
117#define ESB_ST_ERRP_INF (2 << 24) /* process with infinite buffers */
118#define ESB_ST_ERRP_IMM (3 << 24) /* discard mult. with immed. retran. */
119
120#define ESB_ST_OX_ID_INVL (1 << 23) /* originator XID invalid */
121#define ESB_ST_RX_ID_INVL (1 << 22) /* responder XID invalid */
122#define ESB_ST_PRI_INUSE (1 << 21) /* priority / preemption in use */
123
124#endif /* _FC_FC2_H_ */
diff --git a/include/scsi/fc/fc_fcoe.h b/include/scsi/fc/fc_fcoe.h
new file mode 100644
index 00000000000..57aaa8f0d61
--- /dev/null
+++ b/include/scsi/fc/fc_fcoe.h
@@ -0,0 +1,114 @@
1/*
2 * Copyright(c) 2007 Intel Corporation. All rights reserved.
3 *
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,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
16 *
17 * Maintained at www.Open-FCoE.org
18 */
19
20#ifndef _FC_FCOE_H_
21#define _FC_FCOE_H_
22
23/*
24 * FCoE - Fibre Channel over Ethernet.
25 */
26
27/*
28 * The FCoE ethertype eventually goes in net/if_ether.h.
29 */
30#ifndef ETH_P_FCOE
31#define ETH_P_FCOE 0x8906 /* FCOE ether type */
32#endif
33
34#ifndef ETH_P_8021Q
35#define ETH_P_8021Q 0x8100
36#endif
37
38/*
39 * FC_FCOE_OUI hasn't been standardized yet. XXX TBD.
40 */
41#ifndef FC_FCOE_OUI
42#define FC_FCOE_OUI 0x0efc00 /* upper 24 bits of FCOE dest MAC TBD */
43#endif
44
45/*
46 * The destination MAC address for the fabric login may get a different OUI.
47 * This isn't standardized yet.
48 */
49#ifndef FC_FCOE_FLOGI_MAC
50/* gateway MAC - TBD */
51#define FC_FCOE_FLOGI_MAC { 0x0e, 0xfc, 0x00, 0xff, 0xff, 0xfe }
52#endif
53
54#define FC_FCOE_VER 0 /* version */
55
56/*
57 * Ethernet Addresses based on FC S_ID and D_ID.
58 * Generated by FC_FCOE_OUI | S_ID/D_ID
59 */
60#define FC_FCOE_ENCAPS_ID(n) (((u64) FC_FCOE_OUI << 24) | (n))
61#define FC_FCOE_DECAPS_ID(n) ((n) >> 24)
62
63/*
64 * FCoE frame header - 14 bytes
65 *
66 * This is the August 2007 version of the FCoE header as defined by T11.
67 * This follows the VLAN header, which includes the ethertype.
68 */
69struct fcoe_hdr {
70 __u8 fcoe_ver; /* version field - upper 4 bits */
71 __u8 fcoe_resvd[12]; /* reserved - send zero and ignore */
72 __u8 fcoe_sof; /* start of frame per RFC 3643 */
73};
74
75#define FC_FCOE_DECAPS_VER(hp) ((hp)->fcoe_ver >> 4)
76#define FC_FCOE_ENCAPS_VER(hp, ver) ((hp)->fcoe_ver = (ver) << 4)
77
78/*
79 * FCoE CRC & EOF - 8 bytes.
80 */
81struct fcoe_crc_eof {
82 __le32 fcoe_crc32; /* CRC for FC packet */
83 __u8 fcoe_eof; /* EOF from RFC 3643 */
84 __u8 fcoe_resvd[3]; /* reserved - send zero and ignore */
85} __attribute__((packed));
86
87/*
88 * Minimum FCoE + FC header length
89 * 14 bytes FCoE header + 24 byte FC header = 38 bytes
90 */
91#define FCOE_HEADER_LEN 38
92
93/*
94 * Minimum FCoE frame size
95 * 14 bytes FCoE header + 24 byte FC header + 8 byte FCoE trailer = 46 bytes
96 */
97#define FCOE_MIN_FRAME 46
98
99/*
100 * fc_fcoe_set_mac - Store OUI + DID into MAC address field.
101 * @mac: mac address to be set
102 * @did: fc dest id to use
103 */
104static inline void fc_fcoe_set_mac(u8 *mac, u8 *did)
105{
106 mac[0] = (u8) (FC_FCOE_OUI >> 16);
107 mac[1] = (u8) (FC_FCOE_OUI >> 8);
108 mac[2] = (u8) FC_FCOE_OUI;
109 mac[3] = did[0];
110 mac[4] = did[1];
111 mac[5] = did[2];
112}
113
114#endif /* _FC_FCOE_H_ */
diff --git a/include/scsi/fc/fc_fcp.h b/include/scsi/fc/fc_fcp.h
new file mode 100644
index 00000000000..5d38f1989f3
--- /dev/null
+++ b/include/scsi/fc/fc_fcp.h
@@ -0,0 +1,199 @@
1/*
2 * Copyright(c) 2007 Intel Corporation. All rights reserved.
3 *
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,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
16 *
17 * Maintained at www.Open-FCoE.org
18 */
19
20#ifndef _FC_FCP_H_
21#define _FC_FCP_H_
22
23/*
24 * Fibre Channel Protocol for SCSI.
25 * From T10 FCP-3, T10 project 1560-D Rev 4, Sept. 13, 2005.
26 */
27
28/*
29 * fc/fs.h defines FC_TYPE_FCP.
30 */
31
32/*
33 * Service parameter page parameters (word 3 bits) for Process Login.
34 */
35#define FCP_SPPF_TASK_RETRY_ID 0x0200 /* task retry ID requested */
36#define FCP_SPPF_RETRY 0x0100 /* retry supported */
37#define FCP_SPPF_CONF_COMPL 0x0080 /* confirmed completion allowed */
38#define FCP_SPPF_OVLY_ALLOW 0x0040 /* data overlay allowed */
39#define FCP_SPPF_INIT_FCN 0x0020 /* initiator function */
40#define FCP_SPPF_TARG_FCN 0x0010 /* target function */
41#define FCP_SPPF_RD_XRDY_DIS 0x0002 /* disable XFER_RDY for reads */
42#define FCP_SPPF_WR_XRDY_DIS 0x0001 /* disable XFER_RDY for writes */
43
44/*
45 * FCP_CMND IU Payload.
46 */
47struct fcp_cmnd {
48 __u8 fc_lun[8]; /* logical unit number */
49 __u8 fc_cmdref; /* commmand reference number */
50 __u8 fc_pri_ta; /* priority and task attribute */
51 __u8 fc_tm_flags; /* task management flags */
52 __u8 fc_flags; /* additional len & flags */
53 __u8 fc_cdb[16]; /* base CDB */
54 __be32 fc_dl; /* data length (must follow fc_cdb) */
55};
56
57#define FCP_CMND_LEN 32 /* expected length of structure */
58
59struct fcp_cmnd32 {
60 __u8 fc_lun[8]; /* logical unit number */
61 __u8 fc_cmdref; /* commmand reference number */
62 __u8 fc_pri_ta; /* priority and task attribute */
63 __u8 fc_tm_flags; /* task management flags */
64 __u8 fc_flags; /* additional len & flags */
65 __u8 fc_cdb[32]; /* base CDB */
66 __be32 fc_dl; /* data length (must follow fc_cdb) */
67};
68
69#define FCP_CMND32_LEN 48 /* expected length of structure */
70#define FCP_CMND32_ADD_LEN (16 / 4) /* Additional cdb length */
71
72/*
73 * fc_pri_ta.
74 */
75#define FCP_PTA_SIMPLE 0 /* simple task attribute */
76#define FCP_PTA_HEADQ 1 /* head of queue task attribute */
77#define FCP_PTA_ORDERED 2 /* ordered task attribute */
78#define FCP_PTA_ACA 4 /* auto. contigent allegiance */
79#define FCP_PRI_SHIFT 3 /* priority field starts in bit 3 */
80#define FCP_PRI_RESVD_MASK 0x80 /* reserved bits in priority field */
81
82/*
83 * fc_tm_flags - task management flags field.
84 */
85#define FCP_TMF_CLR_ACA 0x40 /* clear ACA condition */
86#define FCP_TMF_LUN_RESET 0x10 /* logical unit reset task management */
87#define FCP_TMF_CLR_TASK_SET 0x04 /* clear task set */
88#define FCP_TMF_ABT_TASK_SET 0x02 /* abort task set */
89
90/*
91 * fc_flags.
92 * Bits 7:2 are the additional FCP_CDB length / 4.
93 */
94#define FCP_CFL_LEN_MASK 0xfc /* mask for additional length */
95#define FCP_CFL_LEN_SHIFT 2 /* shift bits for additional length */
96#define FCP_CFL_RDDATA 0x02 /* read data */
97#define FCP_CFL_WRDATA 0x01 /* write data */
98
99/*
100 * FCP_TXRDY IU - transfer ready payload.
101 */
102struct fcp_txrdy {
103 __be32 ft_data_ro; /* data relative offset */
104 __be32 ft_burst_len; /* burst length */
105 __u8 _ft_resvd[4]; /* reserved */
106};
107
108#define FCP_TXRDY_LEN 12 /* expected length of structure */
109
110/*
111 * FCP_RESP IU - response payload.
112 *
113 * The response payload comes in three parts: the flags/status, the
114 * sense/response lengths and the sense data/response info section.
115 *
116 * From FCP3r04, note 6 of section 9.5.13:
117 *
118 * Some early implementations presented the FCP_RSP IU without the FCP_RESID,
119 * FCP_SNS_LEN, and FCP_RSP_LEN fields if the FCP_RESID_UNDER, FCP_RESID_OVER,
120 * FCP_SNS_LEN_VALID, and FCP_RSP_LEN_VALID bits were all set to zero. This
121 * non-standard behavior should be tolerated.
122 *
123 * All response frames will always contain the fcp_resp template. Some
124 * will also include the fcp_resp_len template.
125 */
126struct fcp_resp {
127 __u8 _fr_resvd[8]; /* reserved */
128 __be16 fr_retry_delay; /* retry delay timer */
129 __u8 fr_flags; /* flags */
130 __u8 fr_status; /* SCSI status code */
131};
132
133#define FCP_RESP_LEN 12 /* expected length of structure */
134
135struct fcp_resp_ext {
136 __be32 fr_resid; /* Residual value */
137 __be32 fr_sns_len; /* SCSI Sense length */
138 __be32 fr_rsp_len; /* Response Info length */
139
140 /*
141 * Optionally followed by RSP info and/or SNS info and/or
142 * bidirectional read residual length, if any.
143 */
144};
145
146#define FCP_RESP_EXT_LEN 12 /* expected length of the structure */
147
148struct fcp_resp_rsp_info {
149 __u8 _fr_resvd[3]; /* reserved */
150 __u8 rsp_code; /* Response Info Code */
151 __u8 _fr_resvd2[4]; /* reserved */
152};
153
154struct fcp_resp_with_ext {
155 struct fcp_resp resp;
156 struct fcp_resp_ext ext;
157};
158
159#define FCP_RESP_WITH_EXT (FCP_RESP_LEN + FCP_RESP_EXT_LEN)
160
161/*
162 * fr_flags.
163 */
164#define FCP_BIDI_RSP 0x80 /* bidirectional read response */
165#define FCP_BIDI_READ_UNDER 0x40 /* bidir. read less than requested */
166#define FCP_BIDI_READ_OVER 0x20 /* DL insufficient for full transfer */
167#define FCP_CONF_REQ 0x10 /* confirmation requested */
168#define FCP_RESID_UNDER 0x08 /* transfer shorter than expected */
169#define FCP_RESID_OVER 0x04 /* DL insufficient for full transfer */
170#define FCP_SNS_LEN_VAL 0x02 /* SNS_LEN field is valid */
171#define FCP_RSP_LEN_VAL 0x01 /* RSP_LEN field is valid */
172
173/*
174 * rsp_codes
175 */
176enum fcp_resp_rsp_codes {
177 FCP_TMF_CMPL = 0,
178 FCP_DATA_LEN_INVALID = 1,
179 FCP_CMND_FIELDS_INVALID = 2,
180 FCP_DATA_PARAM_MISMATCH = 3,
181 FCP_TMF_REJECTED = 4,
182 FCP_TMF_FAILED = 5,
183 FCP_TMF_INVALID_LUN = 9,
184};
185
186/*
187 * FCP SRR Link Service request - Sequence Retransmission Request.
188 */
189struct fcp_srr {
190 __u8 srr_op; /* opcode ELS_SRR */
191 __u8 srr_resvd[3]; /* opcode / reserved - must be zero */
192 __be16 srr_ox_id; /* OX_ID of failed command */
193 __be16 srr_rx_id; /* RX_ID of failed command */
194 __be32 srr_rel_off; /* relative offset */
195 __u8 srr_r_ctl; /* r_ctl for the information unit */
196 __u8 srr_resvd2[3]; /* reserved */
197};
198
199#endif /* _FC_FCP_H_ */
diff --git a/include/scsi/fc/fc_fs.h b/include/scsi/fc/fc_fs.h
new file mode 100644
index 00000000000..3e4801d2bdb
--- /dev/null
+++ b/include/scsi/fc/fc_fs.h
@@ -0,0 +1,340 @@
1/*
2 * Copyright(c) 2007 Intel Corporation. All rights reserved.
3 *
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,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
16 *
17 * Maintained at www.Open-FCoE.org
18 */
19
20#ifndef _FC_FS_H_
21#define _FC_FS_H_
22
23/*
24 * Fibre Channel Framing and Signalling definitions.
25 * From T11 FC-FS-2 Rev 0.90 - 9 August 2005.
26 */
27
28/*
29 * Frame header
30 */
31struct fc_frame_header {
32 __u8 fh_r_ctl; /* routing control */
33 __u8 fh_d_id[3]; /* Destination ID */
34
35 __u8 fh_cs_ctl; /* class of service control / pri */
36 __u8 fh_s_id[3]; /* Source ID */
37
38 __u8 fh_type; /* see enum fc_fh_type below */
39 __u8 fh_f_ctl[3]; /* frame control */
40
41 __u8 fh_seq_id; /* sequence ID */
42 __u8 fh_df_ctl; /* data field control */
43 __be16 fh_seq_cnt; /* sequence count */
44
45 __be16 fh_ox_id; /* originator exchange ID */
46 __be16 fh_rx_id; /* responder exchange ID */
47 __be32 fh_parm_offset; /* parameter or relative offset */
48};
49
50#define FC_FRAME_HEADER_LEN 24 /* expected length of structure */
51
52#define FC_MAX_PAYLOAD 2112U /* max payload length in bytes */
53#define FC_MIN_MAX_PAYLOAD 256U /* lower limit on max payload */
54
55#define FC_MAX_FRAME (FC_MAX_PAYLOAD + FC_FRAME_HEADER_LEN)
56#define FC_MIN_MAX_FRAME (FC_MIN_MAX_PAYLOAD + FC_FRAME_HEADER_LEN)
57
58/*
59 * fh_r_ctl - Routing control definitions.
60 */
61 /*
62 * FC-4 device_data.
63 */
64enum fc_rctl {
65 FC_RCTL_DD_UNCAT = 0x00, /* uncategorized information */
66 FC_RCTL_DD_SOL_DATA = 0x01, /* solicited data */
67 FC_RCTL_DD_UNSOL_CTL = 0x02, /* unsolicited control */
68 FC_RCTL_DD_SOL_CTL = 0x03, /* solicited control or reply */
69 FC_RCTL_DD_UNSOL_DATA = 0x04, /* unsolicited data */
70 FC_RCTL_DD_DATA_DESC = 0x05, /* data descriptor */
71 FC_RCTL_DD_UNSOL_CMD = 0x06, /* unsolicited command */
72 FC_RCTL_DD_CMD_STATUS = 0x07, /* command status */
73
74#define FC_RCTL_ILS_REQ FC_RCTL_DD_UNSOL_CTL /* ILS request */
75#define FC_RCTL_ILS_REP FC_RCTL_DD_SOL_CTL /* ILS reply */
76
77 /*
78 * Extended Link_Data
79 */
80 FC_RCTL_ELS_REQ = 0x22, /* extended link services request */
81 FC_RCTL_ELS_REP = 0x23, /* extended link services reply */
82 FC_RCTL_ELS4_REQ = 0x32, /* FC-4 ELS request */
83 FC_RCTL_ELS4_REP = 0x33, /* FC-4 ELS reply */
84 /*
85 * Optional Extended Headers
86 */
87 FC_RCTL_VFTH = 0x50, /* virtual fabric tagging header */
88 FC_RCTL_IFRH = 0x51, /* inter-fabric routing header */
89 FC_RCTL_ENCH = 0x52, /* encapsulation header */
90 /*
91 * Basic Link Services fh_r_ctl values.
92 */
93 FC_RCTL_BA_NOP = 0x80, /* basic link service NOP */
94 FC_RCTL_BA_ABTS = 0x81, /* basic link service abort */
95 FC_RCTL_BA_RMC = 0x82, /* remove connection */
96 FC_RCTL_BA_ACC = 0x84, /* basic accept */
97 FC_RCTL_BA_RJT = 0x85, /* basic reject */
98 FC_RCTL_BA_PRMT = 0x86, /* dedicated connection preempted */
99 /*
100 * Link Control Information.
101 */
102 FC_RCTL_ACK_1 = 0xc0, /* acknowledge_1 */
103 FC_RCTL_ACK_0 = 0xc1, /* acknowledge_0 */
104 FC_RCTL_P_RJT = 0xc2, /* port reject */
105 FC_RCTL_F_RJT = 0xc3, /* fabric reject */
106 FC_RCTL_P_BSY = 0xc4, /* port busy */
107 FC_RCTL_F_BSY = 0xc5, /* fabric busy to data frame */
108 FC_RCTL_F_BSYL = 0xc6, /* fabric busy to link control frame */
109 FC_RCTL_LCR = 0xc7, /* link credit reset */
110 FC_RCTL_END = 0xc9, /* end */
111};
112 /* incomplete list of definitions */
113
114/*
115 * R_CTL names initializer.
116 * Please keep this matching the above definitions.
117 */
118#define FC_RCTL_NAMES_INIT { \
119 [FC_RCTL_DD_UNCAT] = "uncat", \
120 [FC_RCTL_DD_SOL_DATA] = "sol data", \
121 [FC_RCTL_DD_UNSOL_CTL] = "unsol ctl", \
122 [FC_RCTL_DD_SOL_CTL] = "sol ctl/reply", \
123 [FC_RCTL_DD_UNSOL_DATA] = "unsol data", \
124 [FC_RCTL_DD_DATA_DESC] = "data desc", \
125 [FC_RCTL_DD_UNSOL_CMD] = "unsol cmd", \
126 [FC_RCTL_DD_CMD_STATUS] = "cmd status", \
127 [FC_RCTL_ELS_REQ] = "ELS req", \
128 [FC_RCTL_ELS_REP] = "ELS rep", \
129 [FC_RCTL_ELS4_REQ] = "FC-4 ELS req", \
130 [FC_RCTL_ELS4_REP] = "FC-4 ELS rep", \
131 [FC_RCTL_BA_NOP] = "BLS NOP", \
132 [FC_RCTL_BA_ABTS] = "BLS abort", \
133 [FC_RCTL_BA_RMC] = "BLS remove connection", \
134 [FC_RCTL_BA_ACC] = "BLS accept", \
135 [FC_RCTL_BA_RJT] = "BLS reject", \
136 [FC_RCTL_BA_PRMT] = "BLS dedicated connection preempted", \
137 [FC_RCTL_ACK_1] = "LC ACK_1", \
138 [FC_RCTL_ACK_0] = "LC ACK_0", \
139 [FC_RCTL_P_RJT] = "LC port reject", \
140 [FC_RCTL_F_RJT] = "LC fabric reject", \
141 [FC_RCTL_P_BSY] = "LC port busy", \
142 [FC_RCTL_F_BSY] = "LC fabric busy to data frame", \
143 [FC_RCTL_F_BSYL] = "LC fabric busy to link control frame",\
144 [FC_RCTL_LCR] = "LC link credit reset", \
145 [FC_RCTL_END] = "LC end", \
146}
147
148/*
149 * Well-known fabric addresses.
150 */
151enum fc_well_known_fid {
152 FC_FID_BCAST = 0xffffff, /* broadcast */
153 FC_FID_FLOGI = 0xfffffe, /* fabric login */
154 FC_FID_FCTRL = 0xfffffd, /* fabric controller */
155 FC_FID_DIR_SERV = 0xfffffc, /* directory server */
156 FC_FID_TIME_SERV = 0xfffffb, /* time server */
157 FC_FID_MGMT_SERV = 0xfffffa, /* management server */
158 FC_FID_QOS = 0xfffff9, /* QoS Facilitator */
159 FC_FID_ALIASES = 0xfffff8, /* alias server (FC-PH2) */
160 FC_FID_SEC_KEY = 0xfffff7, /* Security key dist. server */
161 FC_FID_CLOCK = 0xfffff6, /* clock synch server */
162 FC_FID_MCAST_SERV = 0xfffff5, /* multicast server */
163};
164
165#define FC_FID_WELL_KNOWN_MAX 0xffffff /* highest well-known fabric ID */
166#define FC_FID_WELL_KNOWN_BASE 0xfffff5 /* start of well-known fabric ID */
167
168/*
169 * Other well-known addresses, outside the above contiguous range.
170 */
171#define FC_FID_DOM_MGR 0xfffc00 /* domain manager base */
172
173/*
174 * Fabric ID bytes.
175 */
176#define FC_FID_DOMAIN 0
177#define FC_FID_PORT 1
178#define FC_FID_LINK 2
179
180/*
181 * fh_type codes
182 */
183enum fc_fh_type {
184 FC_TYPE_BLS = 0x00, /* basic link service */
185 FC_TYPE_ELS = 0x01, /* extended link service */
186 FC_TYPE_IP = 0x05, /* IP over FC, RFC 4338 */
187 FC_TYPE_FCP = 0x08, /* SCSI FCP */
188 FC_TYPE_CT = 0x20, /* Fibre Channel Services (FC-CT) */
189 FC_TYPE_ILS = 0x22, /* internal link service */
190};
191
192/*
193 * FC_TYPE names initializer.
194 * Please keep this matching the above definitions.
195 */
196#define FC_TYPE_NAMES_INIT { \
197 [FC_TYPE_BLS] = "BLS", \
198 [FC_TYPE_ELS] = "ELS", \
199 [FC_TYPE_IP] = "IP", \
200 [FC_TYPE_FCP] = "FCP", \
201 [FC_TYPE_CT] = "CT", \
202 [FC_TYPE_ILS] = "ILS", \
203}
204
205/*
206 * Exchange IDs.
207 */
208#define FC_XID_UNKNOWN 0xffff /* unknown exchange ID */
209#define FC_XID_MIN 0x0 /* supported min exchange ID */
210#define FC_XID_MAX 0xfffe /* supported max exchange ID */
211
212/*
213 * fh_f_ctl - Frame control flags.
214 */
215#define FC_FC_EX_CTX (1 << 23) /* sent by responder to exchange */
216#define FC_FC_SEQ_CTX (1 << 22) /* sent by responder to sequence */
217#define FC_FC_FIRST_SEQ (1 << 21) /* first sequence of this exchange */
218#define FC_FC_LAST_SEQ (1 << 20) /* last sequence of this exchange */
219#define FC_FC_END_SEQ (1 << 19) /* last frame of sequence */
220#define FC_FC_END_CONN (1 << 18) /* end of class 1 connection pending */
221#define FC_FC_RES_B17 (1 << 17) /* reserved */
222#define FC_FC_SEQ_INIT (1 << 16) /* transfer of sequence initiative */
223#define FC_FC_X_ID_REASS (1 << 15) /* exchange ID has been changed */
224#define FC_FC_X_ID_INVAL (1 << 14) /* exchange ID invalidated */
225
226#define FC_FC_ACK_1 (1 << 12) /* 13:12 = 1: ACK_1 expected */
227#define FC_FC_ACK_N (2 << 12) /* 13:12 = 2: ACK_N expected */
228#define FC_FC_ACK_0 (3 << 12) /* 13:12 = 3: ACK_0 expected */
229
230#define FC_FC_RES_B11 (1 << 11) /* reserved */
231#define FC_FC_RES_B10 (1 << 10) /* reserved */
232#define FC_FC_RETX_SEQ (1 << 9) /* retransmitted sequence */
233#define FC_FC_UNI_TX (1 << 8) /* unidirectional transmit (class 1) */
234#define FC_FC_CONT_SEQ(i) ((i) << 6)
235#define FC_FC_ABT_SEQ(i) ((i) << 4)
236#define FC_FC_REL_OFF (1 << 3) /* parameter is relative offset */
237#define FC_FC_RES2 (1 << 2) /* reserved */
238#define FC_FC_FILL(i) ((i) & 3) /* 1:0: bytes of trailing fill */
239
240/*
241 * BA_ACC payload.
242 */
243struct fc_ba_acc {
244 __u8 ba_seq_id_val; /* SEQ_ID validity */
245#define FC_BA_SEQ_ID_VAL 0x80
246 __u8 ba_seq_id; /* SEQ_ID of seq last deliverable */
247 __u8 ba_resvd[2]; /* reserved */
248 __be16 ba_ox_id; /* OX_ID for aborted seq or exch */
249 __be16 ba_rx_id; /* RX_ID for aborted seq or exch */
250 __be16 ba_low_seq_cnt; /* low SEQ_CNT of aborted seq */
251 __be16 ba_high_seq_cnt; /* high SEQ_CNT of aborted seq */
252};
253
254/*
255 * BA_RJT: Basic Reject payload.
256 */
257struct fc_ba_rjt {
258 __u8 br_resvd; /* reserved */
259 __u8 br_reason; /* reason code */
260 __u8 br_explan; /* reason explanation */
261 __u8 br_vendor; /* vendor unique code */
262};
263
264/*
265 * BA_RJT reason codes.
266 * From FS-2.
267 */
268enum fc_ba_rjt_reason {
269 FC_BA_RJT_NONE = 0, /* in software this means no reject */
270 FC_BA_RJT_INVL_CMD = 0x01, /* invalid command code */
271 FC_BA_RJT_LOG_ERR = 0x03, /* logical error */
272 FC_BA_RJT_LOG_BUSY = 0x05, /* logical busy */
273 FC_BA_RJT_PROTO_ERR = 0x07, /* protocol error */
274 FC_BA_RJT_UNABLE = 0x09, /* unable to perform request */
275 FC_BA_RJT_VENDOR = 0xff, /* vendor-specific (see br_vendor) */
276};
277
278/*
279 * BA_RJT reason code explanations.
280 */
281enum fc_ba_rjt_explan {
282 FC_BA_RJT_EXP_NONE = 0x00, /* no additional expanation */
283 FC_BA_RJT_INV_XID = 0x03, /* invalid OX_ID-RX_ID combination */
284 FC_BA_RJT_ABT = 0x05, /* sequence aborted, no seq info */
285};
286
287/*
288 * P_RJT or F_RJT: Port Reject or Fabric Reject parameter field.
289 */
290struct fc_pf_rjt {
291 __u8 rj_action; /* reserved */
292 __u8 rj_reason; /* reason code */
293 __u8 rj_resvd; /* reserved */
294 __u8 rj_vendor; /* vendor unique code */
295};
296
297/*
298 * P_RJT and F_RJT reject reason codes.
299 */
300enum fc_pf_rjt_reason {
301 FC_RJT_NONE = 0, /* non-reject (reserved by standard) */
302 FC_RJT_INVL_DID = 0x01, /* invalid destination ID */
303 FC_RJT_INVL_SID = 0x02, /* invalid source ID */
304 FC_RJT_P_UNAV_T = 0x03, /* port unavailable, temporary */
305 FC_RJT_P_UNAV = 0x04, /* port unavailable, permanent */
306 FC_RJT_CLS_UNSUP = 0x05, /* class not supported */
307 FC_RJT_DEL_USAGE = 0x06, /* delimiter usage error */
308 FC_RJT_TYPE_UNSUP = 0x07, /* type not supported */
309 FC_RJT_LINK_CTL = 0x08, /* invalid link control */
310 FC_RJT_R_CTL = 0x09, /* invalid R_CTL field */
311 FC_RJT_F_CTL = 0x0a, /* invalid F_CTL field */
312 FC_RJT_OX_ID = 0x0b, /* invalid originator exchange ID */
313 FC_RJT_RX_ID = 0x0c, /* invalid responder exchange ID */
314 FC_RJT_SEQ_ID = 0x0d, /* invalid sequence ID */
315 FC_RJT_DF_CTL = 0x0e, /* invalid DF_CTL field */
316 FC_RJT_SEQ_CNT = 0x0f, /* invalid SEQ_CNT field */
317 FC_RJT_PARAM = 0x10, /* invalid parameter field */
318 FC_RJT_EXCH_ERR = 0x11, /* exchange error */
319 FC_RJT_PROTO = 0x12, /* protocol error */
320 FC_RJT_LEN = 0x13, /* incorrect length */
321 FC_RJT_UNEXP_ACK = 0x14, /* unexpected ACK */
322 FC_RJT_FAB_CLASS = 0x15, /* class unsupported by fabric entity */
323 FC_RJT_LOGI_REQ = 0x16, /* login required */
324 FC_RJT_SEQ_XS = 0x17, /* excessive sequences attempted */
325 FC_RJT_EXCH_EST = 0x18, /* unable to establish exchange */
326 FC_RJT_FAB_UNAV = 0x1a, /* fabric unavailable */
327 FC_RJT_VC_ID = 0x1b, /* invalid VC_ID (class 4) */
328 FC_RJT_CS_CTL = 0x1c, /* invalid CS_CTL field */
329 FC_RJT_INSUF_RES = 0x1d, /* insuff. resources for VC (Class 4) */
330 FC_RJT_INVL_CLS = 0x1f, /* invalid class of service */
331 FC_RJT_PREEMT_RJT = 0x20, /* preemption request rejected */
332 FC_RJT_PREEMT_DIS = 0x21, /* preemption not enabled */
333 FC_RJT_MCAST_ERR = 0x22, /* multicast error */
334 FC_RJT_MCAST_ET = 0x23, /* multicast error terminate */
335 FC_RJT_PRLI_REQ = 0x24, /* process login required */
336 FC_RJT_INVL_ATT = 0x25, /* invalid attachment */
337 FC_RJT_VENDOR = 0xff, /* vendor specific reject */
338};
339
340#endif /* _FC_FS_H_ */
diff --git a/include/scsi/fc/fc_gs.h b/include/scsi/fc/fc_gs.h
new file mode 100644
index 00000000000..ffab0272c65
--- /dev/null
+++ b/include/scsi/fc/fc_gs.h
@@ -0,0 +1,93 @@
1/*
2 * Copyright(c) 2007 Intel Corporation. All rights reserved.
3 *
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,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
16 *
17 * Maintained at www.Open-FCoE.org
18 */
19
20#ifndef _FC_GS_H_
21#define _FC_GS_H_
22
23/*
24 * Fibre Channel Services - Common Transport.
25 * From T11.org FC-GS-2 Rev 5.3 November 1998.
26 */
27
28struct fc_ct_hdr {
29 __u8 ct_rev; /* revision */
30 __u8 ct_in_id[3]; /* N_Port ID of original requestor */
31 __u8 ct_fs_type; /* type of fibre channel service */
32 __u8 ct_fs_subtype; /* subtype */
33 __u8 ct_options;
34 __u8 _ct_resvd1;
35 __be16 ct_cmd; /* command / response code */
36 __be16 ct_mr_size; /* maximum / residual size */
37 __u8 _ct_resvd2;
38 __u8 ct_reason; /* reject reason */
39 __u8 ct_explan; /* reason code explanation */
40 __u8 ct_vendor; /* vendor unique data */
41};
42
43#define FC_CT_HDR_LEN 16 /* expected sizeof (struct fc_ct_hdr) */
44
45enum fc_ct_rev {
46 FC_CT_REV = 1 /* common transport revision */
47};
48
49/*
50 * ct_fs_type values.
51 */
52enum fc_ct_fs_type {
53 FC_FST_ALIAS = 0xf8, /* alias service */
54 FC_FST_MGMT = 0xfa, /* management service */
55 FC_FST_TIME = 0xfb, /* time service */
56 FC_FST_DIR = 0xfc, /* directory service */
57};
58
59/*
60 * ct_cmd: Command / response codes
61 */
62enum fc_ct_cmd {
63 FC_FS_RJT = 0x8001, /* reject */
64 FC_FS_ACC = 0x8002, /* accept */
65};
66
67/*
68 * FS_RJT reason codes.
69 */
70enum fc_ct_reason {
71 FC_FS_RJT_CMD = 0x01, /* invalid command code */
72 FC_FS_RJT_VER = 0x02, /* invalid version level */
73 FC_FS_RJT_LOG = 0x03, /* logical error */
74 FC_FS_RJT_IUSIZ = 0x04, /* invalid IU size */
75 FC_FS_RJT_BSY = 0x05, /* logical busy */
76 FC_FS_RJT_PROTO = 0x07, /* protocol error */
77 FC_FS_RJT_UNABL = 0x09, /* unable to perform command request */
78 FC_FS_RJT_UNSUP = 0x0b, /* command not supported */
79};
80
81/*
82 * FS_RJT reason code explanations.
83 */
84enum fc_ct_explan {
85 FC_FS_EXP_NONE = 0x00, /* no additional explanation */
86 FC_FS_EXP_PID = 0x01, /* port ID not registered */
87 FC_FS_EXP_PNAM = 0x02, /* port name not registered */
88 FC_FS_EXP_NNAM = 0x03, /* node name not registered */
89 FC_FS_EXP_COS = 0x04, /* class of service not registered */
90 /* definitions not complete */
91};
92
93#endif /* _FC_GS_H_ */
diff --git a/include/scsi/fc/fc_ns.h b/include/scsi/fc/fc_ns.h
new file mode 100644
index 00000000000..790d7b97d4b
--- /dev/null
+++ b/include/scsi/fc/fc_ns.h
@@ -0,0 +1,159 @@
1/*
2 * Copyright(c) 2007 Intel Corporation. All rights reserved.
3 *
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,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
16 *
17 * Maintained at www.Open-FCoE.org
18 */
19
20#ifndef _FC_NS_H_
21#define _FC_NS_H_
22
23/*
24 * Fibre Channel Services - Name Service (dNS)
25 * From T11.org FC-GS-2 Rev 5.3 November 1998.
26 */
27
28/*
29 * Common-transport sub-type for Name Server.
30 */
31#define FC_NS_SUBTYPE 2 /* fs_ct_hdr.ct_fs_subtype */
32
33/*
34 * Name server Requests.
35 * Note: this is an incomplete list, some unused requests are omitted.
36 */
37enum fc_ns_req {
38 FC_NS_GA_NXT = 0x0100, /* get all next */
39 FC_NS_GI_A = 0x0101, /* get identifiers - scope */
40 FC_NS_GPN_ID = 0x0112, /* get port name by ID */
41 FC_NS_GNN_ID = 0x0113, /* get node name by ID */
42 FC_NS_GID_PN = 0x0121, /* get ID for port name */
43 FC_NS_GID_NN = 0x0131, /* get IDs for node name */
44 FC_NS_GID_FT = 0x0171, /* get IDs by FC4 type */
45 FC_NS_GPN_FT = 0x0172, /* get port names by FC4 type */
46 FC_NS_GID_PT = 0x01a1, /* get IDs by port type */
47 FC_NS_RFT_ID = 0x0217, /* reg FC4 type for ID */
48 FC_NS_RPN_ID = 0x0212, /* reg port name for ID */
49 FC_NS_RNN_ID = 0x0213, /* reg node name for ID */
50};
51
52/*
53 * Port type values.
54 */
55enum fc_ns_pt {
56 FC_NS_UNID_PORT = 0x00, /* unidentified */
57 FC_NS_N_PORT = 0x01, /* N port */
58 FC_NS_NL_PORT = 0x02, /* NL port */
59 FC_NS_FNL_PORT = 0x03, /* F/NL port */
60 FC_NS_NX_PORT = 0x7f, /* Nx port */
61 FC_NS_F_PORT = 0x81, /* F port */
62 FC_NS_FL_PORT = 0x82, /* FL port */
63 FC_NS_E_PORT = 0x84, /* E port */
64 FC_NS_B_PORT = 0x85, /* B port */
65};
66
67/*
68 * Port type object.
69 */
70struct fc_ns_pt_obj {
71 __u8 pt_type;
72};
73
74/*
75 * Port ID object
76 */
77struct fc_ns_fid {
78 __u8 fp_flags; /* flags for responses only */
79 __u8 fp_fid[3];
80};
81
82/*
83 * fp_flags in port ID object, for responses only.
84 */
85#define FC_NS_FID_LAST 0x80 /* last object */
86
87/*
88 * FC4-types object.
89 */
90#define FC_NS_TYPES 256 /* number of possible FC-4 types */
91#define FC_NS_BPW 32 /* bits per word in bitmap */
92
93struct fc_ns_fts {
94 __be32 ff_type_map[FC_NS_TYPES / FC_NS_BPW]; /* bitmap of FC-4 types */
95};
96
97/*
98 * GID_PT request.
99 */
100struct fc_ns_gid_pt {
101 __u8 fn_pt_type;
102 __u8 fn_domain_id_scope;
103 __u8 fn_area_id_scope;
104 __u8 fn_resvd;
105};
106
107/*
108 * GID_FT or GPN_FT request.
109 */
110struct fc_ns_gid_ft {
111 __u8 fn_resvd;
112 __u8 fn_domain_id_scope;
113 __u8 fn_area_id_scope;
114 __u8 fn_fc4_type;
115};
116
117/*
118 * GPN_FT response.
119 */
120struct fc_gpn_ft_resp {
121 __u8 fp_flags; /* see fp_flags definitions above */
122 __u8 fp_fid[3]; /* port ID */
123 __be32 fp_resvd;
124 __be64 fp_wwpn; /* port name */
125};
126
127/*
128 * GID_PN request
129 */
130struct fc_ns_gid_pn {
131 __be64 fn_wwpn; /* port name */
132};
133
134/*
135 * GID_PN response
136 */
137struct fc_gid_pn_resp {
138 __u8 fp_resvd;
139 __u8 fp_fid[3]; /* port ID */
140};
141
142/*
143 * RFT_ID request - register FC-4 types for ID.
144 */
145struct fc_ns_rft_id {
146 struct fc_ns_fid fr_fid; /* port ID object */
147 struct fc_ns_fts fr_fts; /* FC-4 types object */
148};
149
150/*
151 * RPN_ID request - register port name for ID.
152 * RNN_ID request - register node name for ID.
153 */
154struct fc_ns_rn_id {
155 struct fc_ns_fid fr_fid; /* port ID object */
156 __be64 fr_wwn; /* node name or port name */
157} __attribute__((__packed__));
158
159#endif /* _FC_NS_H_ */
diff --git a/include/scsi/fc_encode.h b/include/scsi/fc_encode.h
new file mode 100644
index 00000000000..6300f556bce
--- /dev/null
+++ b/include/scsi/fc_encode.h
@@ -0,0 +1,309 @@
1/*
2 * Copyright(c) 2008 Intel Corporation. All rights reserved.
3 *
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,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
16 *
17 * Maintained at www.Open-FCoE.org
18 */
19
20#ifndef _FC_ENCODE_H_
21#define _FC_ENCODE_H_
22#include <asm/unaligned.h>
23
24struct fc_ns_rft {
25 struct fc_ns_fid fid; /* port ID object */
26 struct fc_ns_fts fts; /* FC4-types object */
27};
28
29struct fc_ct_req {
30 struct fc_ct_hdr hdr;
31 union {
32 struct fc_ns_gid_ft gid;
33 struct fc_ns_rn_id rn;
34 struct fc_ns_rft rft;
35 } payload;
36};
37
38/**
39 * fill FC header fields in specified fc_frame
40 */
41static inline void fc_fill_fc_hdr(struct fc_frame *fp, enum fc_rctl r_ctl,
42 u32 did, u32 sid, enum fc_fh_type type,
43 u32 f_ctl, u32 parm_offset)
44{
45 struct fc_frame_header *fh;
46
47 fh = fc_frame_header_get(fp);
48 WARN_ON(r_ctl == 0);
49 fh->fh_r_ctl = r_ctl;
50 hton24(fh->fh_d_id, did);
51 hton24(fh->fh_s_id, sid);
52 fh->fh_type = type;
53 hton24(fh->fh_f_ctl, f_ctl);
54 fh->fh_cs_ctl = 0;
55 fh->fh_df_ctl = 0;
56 fh->fh_parm_offset = htonl(parm_offset);
57}
58
59/**
60 * fc_ct_hdr_fill- fills ct header and reset ct payload
61 * returns pointer to ct request.
62 */
63static inline struct fc_ct_req *fc_ct_hdr_fill(const struct fc_frame *fp,
64 unsigned int op, size_t req_size)
65{
66 struct fc_ct_req *ct;
67 size_t ct_plen;
68
69 ct_plen = sizeof(struct fc_ct_hdr) + req_size;
70 ct = fc_frame_payload_get(fp, ct_plen);
71 memset(ct, 0, ct_plen);
72 ct->hdr.ct_rev = FC_CT_REV;
73 ct->hdr.ct_fs_type = FC_FST_DIR;
74 ct->hdr.ct_fs_subtype = FC_NS_SUBTYPE;
75 ct->hdr.ct_cmd = htons((u16) op);
76 return ct;
77}
78
79/**
80 * fc_ct_fill - Fill in a name service request frame
81 */
82static inline int fc_ct_fill(struct fc_lport *lport, struct fc_frame *fp,
83 unsigned int op, enum fc_rctl *r_ctl, u32 *did,
84 enum fc_fh_type *fh_type)
85{
86 struct fc_ct_req *ct;
87
88 switch (op) {
89 case FC_NS_GPN_FT:
90 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_gid_ft));
91 ct->payload.gid.fn_fc4_type = FC_TYPE_FCP;
92 break;
93
94 case FC_NS_RFT_ID:
95 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rft));
96 hton24(ct->payload.rft.fid.fp_fid,
97 fc_host_port_id(lport->host));
98 ct->payload.rft.fts = lport->fcts;
99 break;
100
101 case FC_NS_RPN_ID:
102 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rn_id));
103 hton24(ct->payload.rn.fr_fid.fp_fid,
104 fc_host_port_id(lport->host));
105 ct->payload.rft.fts = lport->fcts;
106 put_unaligned_be64(lport->wwpn, &ct->payload.rn.fr_wwn);
107 break;
108
109 default:
110 FC_DBG("Invalid op code %x \n", op);
111 return -EINVAL;
112 }
113 *r_ctl = FC_RCTL_DD_UNSOL_CTL;
114 *did = FC_FID_DIR_SERV;
115 *fh_type = FC_TYPE_CT;
116 return 0;
117}
118
119/**
120 * fc_plogi_fill - Fill in plogi request frame
121 */
122static inline void fc_plogi_fill(struct fc_lport *lport, struct fc_frame *fp,
123 unsigned int op)
124{
125 struct fc_els_flogi *plogi;
126 struct fc_els_csp *csp;
127 struct fc_els_cssp *cp;
128
129 plogi = fc_frame_payload_get(fp, sizeof(*plogi));
130 memset(plogi, 0, sizeof(*plogi));
131 plogi->fl_cmd = (u8) op;
132 put_unaligned_be64(lport->wwpn, &plogi->fl_wwpn);
133 put_unaligned_be64(lport->wwnn, &plogi->fl_wwnn);
134
135 csp = &plogi->fl_csp;
136 csp->sp_hi_ver = 0x20;
137 csp->sp_lo_ver = 0x20;
138 csp->sp_bb_cred = htons(10); /* this gets set by gateway */
139 csp->sp_bb_data = htons((u16) lport->mfs);
140 cp = &plogi->fl_cssp[3 - 1]; /* class 3 parameters */
141 cp->cp_class = htons(FC_CPC_VALID | FC_CPC_SEQ);
142 csp->sp_features = htons(FC_SP_FT_CIRO);
143 csp->sp_tot_seq = htons(255); /* seq. we accept */
144 csp->sp_rel_off = htons(0x1f);
145 csp->sp_e_d_tov = htonl(lport->e_d_tov);
146
147 cp->cp_rdfs = htons((u16) lport->mfs);
148 cp->cp_con_seq = htons(255);
149 cp->cp_open_seq = 1;
150}
151
152/**
153 * fc_flogi_fill - Fill in a flogi request frame.
154 */
155static inline void fc_flogi_fill(struct fc_lport *lport, struct fc_frame *fp)
156{
157 struct fc_els_csp *sp;
158 struct fc_els_cssp *cp;
159 struct fc_els_flogi *flogi;
160
161 flogi = fc_frame_payload_get(fp, sizeof(*flogi));
162 memset(flogi, 0, sizeof(*flogi));
163 flogi->fl_cmd = (u8) ELS_FLOGI;
164 put_unaligned_be64(lport->wwpn, &flogi->fl_wwpn);
165 put_unaligned_be64(lport->wwnn, &flogi->fl_wwnn);
166 sp = &flogi->fl_csp;
167 sp->sp_hi_ver = 0x20;
168 sp->sp_lo_ver = 0x20;
169 sp->sp_bb_cred = htons(10); /* this gets set by gateway */
170 sp->sp_bb_data = htons((u16) lport->mfs);
171 cp = &flogi->fl_cssp[3 - 1]; /* class 3 parameters */
172 cp->cp_class = htons(FC_CPC_VALID | FC_CPC_SEQ);
173}
174
175/**
176 * fc_logo_fill - Fill in a logo request frame.
177 */
178static inline void fc_logo_fill(struct fc_lport *lport, struct fc_frame *fp)
179{
180 struct fc_els_logo *logo;
181
182 logo = fc_frame_payload_get(fp, sizeof(*logo));
183 memset(logo, 0, sizeof(*logo));
184 logo->fl_cmd = ELS_LOGO;
185 hton24(logo->fl_n_port_id, fc_host_port_id(lport->host));
186 logo->fl_n_port_wwn = htonll(lport->wwpn);
187}
188
189/**
190 * fc_rtv_fill - Fill in RTV (read timeout value) request frame.
191 */
192static inline void fc_rtv_fill(struct fc_lport *lport, struct fc_frame *fp)
193{
194 struct fc_els_rtv *rtv;
195
196 rtv = fc_frame_payload_get(fp, sizeof(*rtv));
197 memset(rtv, 0, sizeof(*rtv));
198 rtv->rtv_cmd = ELS_RTV;
199}
200
201/**
202 * fc_rec_fill - Fill in rec request frame
203 */
204static inline void fc_rec_fill(struct fc_lport *lport, struct fc_frame *fp)
205{
206 struct fc_els_rec *rec;
207 struct fc_exch *ep = fc_seq_exch(fr_seq(fp));
208
209 rec = fc_frame_payload_get(fp, sizeof(*rec));
210 memset(rec, 0, sizeof(*rec));
211 rec->rec_cmd = ELS_REC;
212 hton24(rec->rec_s_id, fc_host_port_id(lport->host));
213 rec->rec_ox_id = htons(ep->oxid);
214 rec->rec_rx_id = htons(ep->rxid);
215}
216
217/**
218 * fc_prli_fill - Fill in prli request frame
219 */
220static inline void fc_prli_fill(struct fc_lport *lport, struct fc_frame *fp)
221{
222 struct {
223 struct fc_els_prli prli;
224 struct fc_els_spp spp;
225 } *pp;
226
227 pp = fc_frame_payload_get(fp, sizeof(*pp));
228 memset(pp, 0, sizeof(*pp));
229 pp->prli.prli_cmd = ELS_PRLI;
230 pp->prli.prli_spp_len = sizeof(struct fc_els_spp);
231 pp->prli.prli_len = htons(sizeof(*pp));
232 pp->spp.spp_type = FC_TYPE_FCP;
233 pp->spp.spp_flags = FC_SPP_EST_IMG_PAIR;
234 pp->spp.spp_params = htonl(lport->service_params);
235}
236
237/**
238 * fc_scr_fill - Fill in a scr request frame.
239 */
240static inline void fc_scr_fill(struct fc_lport *lport, struct fc_frame *fp)
241{
242 struct fc_els_scr *scr;
243
244 scr = fc_frame_payload_get(fp, sizeof(*scr));
245 memset(scr, 0, sizeof(*scr));
246 scr->scr_cmd = ELS_SCR;
247 scr->scr_reg_func = ELS_SCRF_FULL;
248}
249
250/**
251 * fc_els_fill - Fill in an ELS request frame
252 */
253static inline int fc_els_fill(struct fc_lport *lport, struct fc_rport *rport,
254 struct fc_frame *fp, unsigned int op,
255 enum fc_rctl *r_ctl, u32 *did, enum fc_fh_type *fh_type)
256{
257 switch (op) {
258 case ELS_PLOGI:
259 fc_plogi_fill(lport, fp, ELS_PLOGI);
260 *did = rport->port_id;
261 break;
262
263 case ELS_FLOGI:
264 fc_flogi_fill(lport, fp);
265 *did = FC_FID_FLOGI;
266 break;
267
268 case ELS_LOGO:
269 fc_logo_fill(lport, fp);
270 *did = FC_FID_FLOGI;
271 /*
272 * if rport is valid then it
273 * is port logo, therefore
274 * set did to rport id.
275 */
276 if (rport)
277 *did = rport->port_id;
278 break;
279
280 case ELS_RTV:
281 fc_rtv_fill(lport, fp);
282 *did = rport->port_id;
283 break;
284
285 case ELS_REC:
286 fc_rec_fill(lport, fp);
287 *did = rport->port_id;
288 break;
289
290 case ELS_PRLI:
291 fc_prli_fill(lport, fp);
292 *did = rport->port_id;
293 break;
294
295 case ELS_SCR:
296 fc_scr_fill(lport, fp);
297 *did = FC_FID_FCTRL;
298 break;
299
300 default:
301 FC_DBG("Invalid op code %x \n", op);
302 return -EINVAL;
303 }
304
305 *r_ctl = FC_RCTL_ELS_REQ;
306 *fh_type = FC_TYPE_ELS;
307 return 0;
308}
309#endif /* _FC_ENCODE_H_ */
diff --git a/include/scsi/fc_frame.h b/include/scsi/fc_frame.h
new file mode 100644
index 00000000000..04d34a71355
--- /dev/null
+++ b/include/scsi/fc_frame.h
@@ -0,0 +1,242 @@
1/*
2 * Copyright(c) 2007 Intel Corporation. All rights reserved.
3 *
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,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
16 *
17 * Maintained at www.Open-FCoE.org
18 */
19
20#ifndef _FC_FRAME_H_
21#define _FC_FRAME_H_
22
23#include <linux/scatterlist.h>
24#include <linux/skbuff.h>
25#include <scsi/scsi_cmnd.h>
26
27#include <scsi/fc/fc_fs.h>
28#include <scsi/fc/fc_fcp.h>
29#include <scsi/fc/fc_encaps.h>
30
31/*
32 * The fc_frame interface is used to pass frame data between functions.
33 * The frame includes the data buffer, length, and SOF / EOF delimiter types.
34 * A pointer to the port structure of the receiving port is also includeded.
35 */
36
37#define FC_FRAME_HEADROOM 32 /* headroom for VLAN + FCoE headers */
38#define FC_FRAME_TAILROOM 8 /* trailer space for FCoE */
39
40/*
41 * Information about an individual fibre channel frame received or to be sent.
42 * The buffer may be in up to 4 additional non-contiguous sections,
43 * but the linear section must hold the frame header.
44 */
45#define FC_FRAME_SG_LEN 4 /* scatter/gather list maximum length */
46
47#define fp_skb(fp) (&((fp)->skb))
48#define fr_hdr(fp) ((fp)->skb.data)
49#define fr_len(fp) ((fp)->skb.len)
50#define fr_cb(fp) ((struct fcoe_rcv_info *)&((fp)->skb.cb[0]))
51#define fr_dev(fp) (fr_cb(fp)->fr_dev)
52#define fr_seq(fp) (fr_cb(fp)->fr_seq)
53#define fr_sof(fp) (fr_cb(fp)->fr_sof)
54#define fr_eof(fp) (fr_cb(fp)->fr_eof)
55#define fr_flags(fp) (fr_cb(fp)->fr_flags)
56#define fr_max_payload(fp) (fr_cb(fp)->fr_max_payload)
57#define fr_cmd(fp) (fr_cb(fp)->fr_cmd)
58#define fr_dir(fp) (fr_cmd(fp)->sc_data_direction)
59#define fr_crc(fp) (fr_cb(fp)->fr_crc)
60
61struct fc_frame {
62 struct sk_buff skb;
63};
64
65struct fcoe_rcv_info {
66 struct packet_type *ptype;
67 struct fc_lport *fr_dev; /* transport layer private pointer */
68 struct fc_seq *fr_seq; /* for use with exchange manager */
69 struct scsi_cmnd *fr_cmd; /* for use of scsi command */
70 u32 fr_crc;
71 u16 fr_max_payload; /* max FC payload */
72 enum fc_sof fr_sof; /* start of frame delimiter */
73 enum fc_eof fr_eof; /* end of frame delimiter */
74 u8 fr_flags; /* flags - see below */
75};
76
77
78/*
79 * Get fc_frame pointer for an skb that's already been imported.
80 */
81static inline struct fcoe_rcv_info *fcoe_dev_from_skb(const struct sk_buff *skb)
82{
83 BUILD_BUG_ON(sizeof(struct fcoe_rcv_info) > sizeof(skb->cb));
84 return (struct fcoe_rcv_info *) skb->cb;
85}
86
87/*
88 * fr_flags.
89 */
90#define FCPHF_CRC_UNCHECKED 0x01 /* CRC not computed, still appended */
91
92/*
93 * Initialize a frame.
94 * We don't do a complete memset here for performance reasons.
95 * The caller must set fr_free, fr_hdr, fr_len, fr_sof, and fr_eof eventually.
96 */
97static inline void fc_frame_init(struct fc_frame *fp)
98{
99 fr_dev(fp) = NULL;
100 fr_seq(fp) = NULL;
101 fr_flags(fp) = 0;
102}
103
104struct fc_frame *fc_frame_alloc_fill(struct fc_lport *, size_t payload_len);
105
106struct fc_frame *__fc_frame_alloc(size_t payload_len);
107
108/*
109 * Get frame for sending via port.
110 */
111static inline struct fc_frame *_fc_frame_alloc(struct fc_lport *dev,
112 size_t payload_len)
113{
114 return __fc_frame_alloc(payload_len);
115}
116
117/*
118 * Allocate fc_frame structure and buffer. Set the initial length to
119 * payload_size + sizeof (struct fc_frame_header).
120 */
121static inline struct fc_frame *fc_frame_alloc(struct fc_lport *dev, size_t len)
122{
123 struct fc_frame *fp;
124
125 /*
126 * Note: Since len will often be a constant multiple of 4,
127 * this check will usually be evaluated and eliminated at compile time.
128 */
129 if ((len % 4) != 0)
130 fp = fc_frame_alloc_fill(dev, len);
131 else
132 fp = _fc_frame_alloc(dev, len);
133 return fp;
134}
135
136/*
137 * Free the fc_frame structure and buffer.
138 */
139static inline void fc_frame_free(struct fc_frame *fp)
140{
141 kfree_skb(fp_skb(fp));
142}
143
144static inline int fc_frame_is_linear(struct fc_frame *fp)
145{
146 return !skb_is_nonlinear(fp_skb(fp));
147}
148
149/*
150 * Get frame header from message in fc_frame structure.
151 * This hides a cast and provides a place to add some checking.
152 */
153static inline
154struct fc_frame_header *fc_frame_header_get(const struct fc_frame *fp)
155{
156 WARN_ON(fr_len(fp) < sizeof(struct fc_frame_header));
157 return (struct fc_frame_header *) fr_hdr(fp);
158}
159
160/*
161 * Get frame payload from message in fc_frame structure.
162 * This hides a cast and provides a place to add some checking.
163 * The len parameter is the minimum length for the payload portion.
164 * Returns NULL if the frame is too short.
165 *
166 * This assumes the interesting part of the payload is in the first part
167 * of the buffer for received data. This may not be appropriate to use for
168 * buffers being transmitted.
169 */
170static inline void *fc_frame_payload_get(const struct fc_frame *fp,
171 size_t len)
172{
173 void *pp = NULL;
174
175 if (fr_len(fp) >= sizeof(struct fc_frame_header) + len)
176 pp = fc_frame_header_get(fp) + 1;
177 return pp;
178}
179
180/*
181 * Get frame payload opcode (first byte) from message in fc_frame structure.
182 * This hides a cast and provides a place to add some checking. Return 0
183 * if the frame has no payload.
184 */
185static inline u8 fc_frame_payload_op(const struct fc_frame *fp)
186{
187 u8 *cp;
188
189 cp = fc_frame_payload_get(fp, sizeof(u8));
190 if (!cp)
191 return 0;
192 return *cp;
193
194}
195
196/*
197 * Get FC class from frame.
198 */
199static inline enum fc_class fc_frame_class(const struct fc_frame *fp)
200{
201 return fc_sof_class(fr_sof(fp));
202}
203
204/*
205 * Check the CRC in a frame.
206 * The CRC immediately follows the last data item *AFTER* the length.
207 * The return value is zero if the CRC matches.
208 */
209u32 fc_frame_crc_check(struct fc_frame *);
210
211static inline u8 fc_frame_rctl(const struct fc_frame *fp)
212{
213 return fc_frame_header_get(fp)->fh_r_ctl;
214}
215
216static inline bool fc_frame_is_cmd(const struct fc_frame *fp)
217{
218 return fc_frame_rctl(fp) == FC_RCTL_DD_UNSOL_CMD;
219}
220
221static inline bool fc_frame_is_read(const struct fc_frame *fp)
222{
223 if (fc_frame_is_cmd(fp) && fr_cmd(fp))
224 return fr_dir(fp) == DMA_FROM_DEVICE;
225 return false;
226}
227
228static inline bool fc_frame_is_write(const struct fc_frame *fp)
229{
230 if (fc_frame_is_cmd(fp) && fr_cmd(fp))
231 return fr_dir(fp) == DMA_TO_DEVICE;
232 return false;
233}
234
235/*
236 * Check for leaks.
237 * Print the frame header of any currently allocated frame, assuming there
238 * should be none at this point.
239 */
240void fc_frame_leak_check(void);
241
242#endif /* _FC_FRAME_H_ */
diff --git a/include/scsi/fc_transport_fcoe.h b/include/scsi/fc_transport_fcoe.h
new file mode 100644
index 00000000000..8dca2af14ff
--- /dev/null
+++ b/include/scsi/fc_transport_fcoe.h
@@ -0,0 +1,54 @@
1#ifndef FC_TRANSPORT_FCOE_H
2#define FC_TRANSPORT_FCOE_H
3
4#include <linux/device.h>
5#include <linux/netdevice.h>
6#include <scsi/scsi_host.h>
7#include <scsi/libfc.h>
8
9/**
10 * struct fcoe_transport - FCoE transport struct for generic transport
11 * for Ethernet devices as well as pure HBAs
12 *
13 * @name: name for thsi transport
14 * @bus: physical bus type (pci_bus_type)
15 * @driver: physical bus driver for network device
16 * @create: entry create function
17 * @destroy: exit destroy function
18 * @list: list of transports
19 */
20struct fcoe_transport {
21 char *name;
22 unsigned short vendor;
23 unsigned short device;
24 struct bus_type *bus;
25 struct device_driver *driver;
26 int (*create)(struct net_device *device);
27 int (*destroy)(struct net_device *device);
28 bool (*match)(struct net_device *device);
29 struct list_head list;
30 struct list_head devlist;
31 struct mutex devlock;
32};
33
34/**
35 * MODULE_ALIAS_FCOE_PCI
36 *
37 * some care must be taken with this, vendor and device MUST be a hex value
38 * preceded with 0x and with letters in lower case (0x12ab, not 0x12AB or 12AB)
39 */
40#define MODULE_ALIAS_FCOE_PCI(vendor, device) \
41 MODULE_ALIAS("fcoe-pci-" __stringify(vendor) "-" __stringify(device))
42
43/* exported funcs */
44int fcoe_transport_attach(struct net_device *netdev);
45int fcoe_transport_release(struct net_device *netdev);
46int fcoe_transport_register(struct fcoe_transport *t);
47int fcoe_transport_unregister(struct fcoe_transport *t);
48int fcoe_load_transport_driver(struct net_device *netdev);
49int __init fcoe_transport_init(void);
50int __exit fcoe_transport_exit(void);
51
52/* fcow_sw is the default transport */
53extern struct fcoe_transport fcoe_sw_transport;
54#endif /* FC_TRANSPORT_FCOE_H */
diff --git a/include/scsi/iscsi_if.h b/include/scsi/iscsi_if.h
index 0c9514de5df..d0ed5226f8c 100644
--- a/include/scsi/iscsi_if.h
+++ b/include/scsi/iscsi_if.h
@@ -333,8 +333,11 @@ enum iscsi_host_param {
333#define CAP_TEXT_NEGO 0x80 333#define CAP_TEXT_NEGO 0x80
334#define CAP_MARKERS 0x100 334#define CAP_MARKERS 0x100
335#define CAP_FW_DB 0x200 335#define CAP_FW_DB 0x200
336#define CAP_SENDTARGETS_OFFLOAD 0x400 336#define CAP_SENDTARGETS_OFFLOAD 0x400 /* offload discovery process */
337#define CAP_DATA_PATH_OFFLOAD 0x800 337#define CAP_DATA_PATH_OFFLOAD 0x800 /* offload entire IO path */
338#define CAP_DIGEST_OFFLOAD 0x1000 /* offload hdr and data digests */
339#define CAP_PADDING_OFFLOAD 0x2000 /* offload padding insertion, removal,
340 and verification */
338 341
339/* 342/*
340 * These flags describes reason of stop_conn() call 343 * These flags describes reason of stop_conn() call
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h
new file mode 100644
index 00000000000..9f2876397dd
--- /dev/null
+++ b/include/scsi/libfc.h
@@ -0,0 +1,938 @@
1/*
2 * Copyright(c) 2007 Intel Corporation. All rights reserved.
3 *
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,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
16 *
17 * Maintained at www.Open-FCoE.org
18 */
19
20#ifndef _LIBFC_H_
21#define _LIBFC_H_
22
23#include <linux/timer.h>
24#include <linux/if.h>
25
26#include <scsi/scsi_transport.h>
27#include <scsi/scsi_transport_fc.h>
28
29#include <scsi/fc/fc_fcp.h>
30#include <scsi/fc/fc_ns.h>
31#include <scsi/fc/fc_els.h>
32#include <scsi/fc/fc_gs.h>
33
34#include <scsi/fc_frame.h>
35
36#define LIBFC_DEBUG
37
38#ifdef LIBFC_DEBUG
39/* Log messages */
40#define FC_DBG(fmt, args...) \
41 do { \
42 printk(KERN_INFO "%s " fmt, __func__, ##args); \
43 } while (0)
44#else
45#define FC_DBG(fmt, args...)
46#endif
47
48/*
49 * libfc error codes
50 */
51#define FC_NO_ERR 0 /* no error */
52#define FC_EX_TIMEOUT 1 /* Exchange timeout */
53#define FC_EX_CLOSED 2 /* Exchange closed */
54
55/* some helpful macros */
56
57#define ntohll(x) be64_to_cpu(x)
58#define htonll(x) cpu_to_be64(x)
59
60#define ntoh24(p) (((p)[0] << 16) | ((p)[1] << 8) | ((p)[2]))
61
62#define hton24(p, v) do { \
63 p[0] = (((v) >> 16) & 0xFF); \
64 p[1] = (((v) >> 8) & 0xFF); \
65 p[2] = ((v) & 0xFF); \
66 } while (0)
67
68/*
69 * FC HBA status
70 */
71#define FC_PAUSE (1 << 1)
72#define FC_LINK_UP (1 << 0)
73
74enum fc_lport_state {
75 LPORT_ST_NONE = 0,
76 LPORT_ST_FLOGI,
77 LPORT_ST_DNS,
78 LPORT_ST_RPN_ID,
79 LPORT_ST_RFT_ID,
80 LPORT_ST_SCR,
81 LPORT_ST_READY,
82 LPORT_ST_LOGO,
83 LPORT_ST_RESET
84};
85
86enum fc_disc_event {
87 DISC_EV_NONE = 0,
88 DISC_EV_SUCCESS,
89 DISC_EV_FAILED
90};
91
92enum fc_rport_state {
93 RPORT_ST_NONE = 0,
94 RPORT_ST_INIT, /* initialized */
95 RPORT_ST_PLOGI, /* waiting for PLOGI completion */
96 RPORT_ST_PRLI, /* waiting for PRLI completion */
97 RPORT_ST_RTV, /* waiting for RTV completion */
98 RPORT_ST_READY, /* ready for use */
99 RPORT_ST_LOGO, /* port logout sent */
100};
101
102enum fc_rport_trans_state {
103 FC_PORTSTATE_ROGUE,
104 FC_PORTSTATE_REAL,
105};
106
107/**
108 * struct fc_disc_port - temporary discovery port to hold rport identifiers
109 * @lp: Fibre Channel host port instance
110 * @peers: node for list management during discovery and RSCN processing
111 * @ids: identifiers structure to pass to fc_remote_port_add()
112 * @rport_work: work struct for starting the rport state machine
113 */
114struct fc_disc_port {
115 struct fc_lport *lp;
116 struct list_head peers;
117 struct fc_rport_identifiers ids;
118 struct work_struct rport_work;
119};
120
121enum fc_rport_event {
122 RPORT_EV_NONE = 0,
123 RPORT_EV_CREATED,
124 RPORT_EV_FAILED,
125 RPORT_EV_STOP,
126 RPORT_EV_LOGO
127};
128
129struct fc_rport_operations {
130 void (*event_callback)(struct fc_lport *, struct fc_rport *,
131 enum fc_rport_event);
132};
133
134/**
135 * struct fc_rport_libfc_priv - libfc internal information about a remote port
136 * @local_port: Fibre Channel host port instance
137 * @rp_state: state tracks progress of PLOGI, PRLI, and RTV exchanges
138 * @flags: REC and RETRY supported flags
139 * @max_seq: maximum number of concurrent sequences
140 * @retries: retry count in current state
141 * @e_d_tov: error detect timeout value (in msec)
142 * @r_a_tov: resource allocation timeout value (in msec)
143 * @rp_mutex: mutex protects rport
144 * @retry_work:
145 * @event_callback: Callback for rport READY, FAILED or LOGO
146 */
147struct fc_rport_libfc_priv {
148 struct fc_lport *local_port;
149 enum fc_rport_state rp_state;
150 u16 flags;
151 #define FC_RP_FLAGS_REC_SUPPORTED (1 << 0)
152 #define FC_RP_FLAGS_RETRY (1 << 1)
153 u16 max_seq;
154 unsigned int retries;
155 unsigned int e_d_tov;
156 unsigned int r_a_tov;
157 enum fc_rport_trans_state trans_state;
158 struct mutex rp_mutex;
159 struct delayed_work retry_work;
160 enum fc_rport_event event;
161 struct fc_rport_operations *ops;
162 struct list_head peers;
163 struct work_struct event_work;
164};
165
166#define PRIV_TO_RPORT(x) \
167 (struct fc_rport *)((void *)x - sizeof(struct fc_rport));
168#define RPORT_TO_PRIV(x) \
169 (struct fc_rport_libfc_priv *)((void *)x + sizeof(struct fc_rport));
170
171struct fc_rport *fc_rport_rogue_create(struct fc_disc_port *);
172
173static inline void fc_rport_set_name(struct fc_rport *rport, u64 wwpn, u64 wwnn)
174{
175 rport->node_name = wwnn;
176 rport->port_name = wwpn;
177}
178
179/*
180 * fcoe stats structure
181 */
182struct fcoe_dev_stats {
183 u64 SecondsSinceLastReset;
184 u64 TxFrames;
185 u64 TxWords;
186 u64 RxFrames;
187 u64 RxWords;
188 u64 ErrorFrames;
189 u64 DumpedFrames;
190 u64 LinkFailureCount;
191 u64 LossOfSignalCount;
192 u64 InvalidTxWordCount;
193 u64 InvalidCRCCount;
194 u64 InputRequests;
195 u64 OutputRequests;
196 u64 ControlRequests;
197 u64 InputMegabytes;
198 u64 OutputMegabytes;
199};
200
201/*
202 * els data is used for passing ELS respone specific
203 * data to send ELS response mainly using infomation
204 * in exchange and sequence in EM layer.
205 */
206struct fc_seq_els_data {
207 struct fc_frame *fp;
208 enum fc_els_rjt_reason reason;
209 enum fc_els_rjt_explan explan;
210};
211
212/*
213 * FCP request structure, one for each scsi cmd request
214 */
215struct fc_fcp_pkt {
216 /*
217 * housekeeping stuff
218 */
219 struct fc_lport *lp; /* handle to hba struct */
220 u16 state; /* scsi_pkt state state */
221 u16 tgt_flags; /* target flags */
222 atomic_t ref_cnt; /* fcp pkt ref count */
223 spinlock_t scsi_pkt_lock; /* Must be taken before the host lock
224 * if both are held at the same time */
225 /*
226 * SCSI I/O related stuff
227 */
228 struct scsi_cmnd *cmd; /* scsi command pointer. set/clear
229 * under host lock */
230 struct list_head list; /* tracks queued commands. access under
231 * host lock */
232 /*
233 * timeout related stuff
234 */
235 struct timer_list timer; /* command timer */
236 struct completion tm_done;
237 int wait_for_comp;
238 unsigned long start_time; /* start jiffie */
239 unsigned long end_time; /* end jiffie */
240 unsigned long last_pkt_time; /* jiffies of last frame received */
241
242 /*
243 * scsi cmd and data transfer information
244 */
245 u32 data_len;
246 /*
247 * transport related veriables
248 */
249 struct fcp_cmnd cdb_cmd;
250 size_t xfer_len;
251 u32 xfer_contig_end; /* offset of end of contiguous xfer */
252 u16 max_payload; /* max payload size in bytes */
253
254 /*
255 * scsi/fcp return status
256 */
257 u32 io_status; /* SCSI result upper 24 bits */
258 u8 cdb_status;
259 u8 status_code; /* FCP I/O status */
260 /* bit 3 Underrun bit 2: overrun */
261 u8 scsi_comp_flags;
262 u32 req_flags; /* bit 0: read bit:1 write */
263 u32 scsi_resid; /* residule length */
264
265 struct fc_rport *rport; /* remote port pointer */
266 struct fc_seq *seq_ptr; /* current sequence pointer */
267 /*
268 * Error Processing
269 */
270 u8 recov_retry; /* count of recovery retries */
271 struct fc_seq *recov_seq; /* sequence for REC or SRR */
272};
273
274/*
275 * Structure and function definitions for managing Fibre Channel Exchanges
276 * and Sequences
277 *
278 * fc_exch holds state for one exchange and links to its active sequence.
279 *
280 * fc_seq holds the state for an individual sequence.
281 */
282
283struct fc_exch_mgr;
284
285/*
286 * Sequence.
287 */
288struct fc_seq {
289 u8 id; /* seq ID */
290 u16 ssb_stat; /* status flags for sequence status block */
291 u16 cnt; /* frames sent so far on sequence */
292 u32 rec_data; /* FC-4 value for REC */
293};
294
295#define FC_EX_DONE (1 << 0) /* ep is completed */
296#define FC_EX_RST_CLEANUP (1 << 1) /* reset is forcing completion */
297
298/*
299 * Exchange.
300 *
301 * Locking notes: The ex_lock protects following items:
302 * state, esb_stat, f_ctl, seq.ssb_stat
303 * seq_id
304 * sequence allocation
305 */
306struct fc_exch {
307 struct fc_exch_mgr *em; /* exchange manager */
308 u32 state; /* internal driver state */
309 u16 xid; /* our exchange ID */
310 struct list_head ex_list; /* free or busy list linkage */
311 spinlock_t ex_lock; /* lock covering exchange state */
312 atomic_t ex_refcnt; /* reference counter */
313 struct delayed_work timeout_work; /* timer for upper level protocols */
314 struct fc_lport *lp; /* fc device instance */
315 u16 oxid; /* originator's exchange ID */
316 u16 rxid; /* responder's exchange ID */
317 u32 oid; /* originator's FCID */
318 u32 sid; /* source FCID */
319 u32 did; /* destination FCID */
320 u32 esb_stat; /* exchange status for ESB */
321 u32 r_a_tov; /* r_a_tov from rport (msec) */
322 u8 seq_id; /* next sequence ID to use */
323 u32 f_ctl; /* F_CTL flags for sequences */
324 u8 fh_type; /* frame type */
325 enum fc_class class; /* class of service */
326 struct fc_seq seq; /* single sequence */
327 /*
328 * Handler for responses to this current exchange.
329 */
330 void (*resp)(struct fc_seq *, struct fc_frame *, void *);
331 void (*destructor)(struct fc_seq *, void *);
332 /*
333 * arg is passed as void pointer to exchange
334 * resp and destructor handlers
335 */
336 void *arg;
337};
338#define fc_seq_exch(sp) container_of(sp, struct fc_exch, seq)
339
340struct libfc_function_template {
341
342 /**
343 * Mandatory Fields
344 *
345 * These handlers must be implemented by the LLD.
346 */
347
348 /*
349 * Interface to send a FC frame
350 */
351 int (*frame_send)(struct fc_lport *lp, struct fc_frame *fp);
352
353 /**
354 * Optional Fields
355 *
356 * The LLD may choose to implement any of the following handlers.
357 * If LLD doesn't specify hander and leaves its pointer NULL then
358 * the default libfc function will be used for that handler.
359 */
360
361 /**
362 * ELS/CT interfaces
363 */
364
365 /*
366 * elsct_send - sends ELS/CT frame
367 */
368 struct fc_seq *(*elsct_send)(struct fc_lport *lport,
369 struct fc_rport *rport,
370 struct fc_frame *fp,
371 unsigned int op,
372 void (*resp)(struct fc_seq *,
373 struct fc_frame *fp,
374 void *arg),
375 void *arg, u32 timer_msec);
376 /**
377 * Exhance Manager interfaces
378 */
379
380 /*
381 * Send the FC frame payload using a new exchange and sequence.
382 *
383 * The frame pointer with some of the header's fields must be
384 * filled before calling exch_seq_send(), those fields are,
385 *
386 * - routing control
387 * - FC port did
388 * - FC port sid
389 * - FC header type
390 * - frame control
391 * - parameter or relative offset
392 *
393 * The exchange response handler is set in this routine to resp()
394 * function pointer. It can be called in two scenarios: if a timeout
395 * occurs or if a response frame is received for the exchange. The
396 * fc_frame pointer in response handler will also indicate timeout
397 * as error using IS_ERR related macros.
398 *
399 * The exchange destructor handler is also set in this routine.
400 * The destructor handler is invoked by EM layer when exchange
401 * is about to free, this can be used by caller to free its
402 * resources along with exchange free.
403 *
404 * The arg is passed back to resp and destructor handler.
405 *
406 * The timeout value (in msec) for an exchange is set if non zero
407 * timer_msec argument is specified. The timer is canceled when
408 * it fires or when the exchange is done. The exchange timeout handler
409 * is registered by EM layer.
410 */
411 struct fc_seq *(*exch_seq_send)(struct fc_lport *lp,
412 struct fc_frame *fp,
413 void (*resp)(struct fc_seq *sp,
414 struct fc_frame *fp,
415 void *arg),
416 void (*destructor)(struct fc_seq *sp,
417 void *arg),
418 void *arg, unsigned int timer_msec);
419
420 /*
421 * send a frame using existing sequence and exchange.
422 */
423 int (*seq_send)(struct fc_lport *lp, struct fc_seq *sp,
424 struct fc_frame *fp);
425
426 /*
427 * Send ELS response using mainly infomation
428 * in exchange and sequence in EM layer.
429 */
430 void (*seq_els_rsp_send)(struct fc_seq *sp, enum fc_els_cmd els_cmd,
431 struct fc_seq_els_data *els_data);
432
433 /*
434 * Abort an exchange and sequence. Generally called because of a
435 * exchange timeout or an abort from the upper layer.
436 *
437 * A timer_msec can be specified for abort timeout, if non-zero
438 * timer_msec value is specified then exchange resp handler
439 * will be called with timeout error if no response to abort.
440 */
441 int (*seq_exch_abort)(const struct fc_seq *req_sp,
442 unsigned int timer_msec);
443
444 /*
445 * Indicate that an exchange/sequence tuple is complete and the memory
446 * allocated for the related objects may be freed.
447 */
448 void (*exch_done)(struct fc_seq *sp);
449
450 /*
451 * Assigns a EM and a free XID for an new exchange and then
452 * allocates a new exchange and sequence pair.
453 * The fp can be used to determine free XID.
454 */
455 struct fc_exch *(*exch_get)(struct fc_lport *lp, struct fc_frame *fp);
456
457 /*
458 * Release previously assigned XID by exch_get API.
459 * The LLD may implement this if XID is assigned by LLD
460 * in exch_get().
461 */
462 void (*exch_put)(struct fc_lport *lp, struct fc_exch_mgr *mp,
463 u16 ex_id);
464
465 /*
466 * Start a new sequence on the same exchange/sequence tuple.
467 */
468 struct fc_seq *(*seq_start_next)(struct fc_seq *sp);
469
470 /*
471 * Reset an exchange manager, completing all sequences and exchanges.
472 * If s_id is non-zero, reset only exchanges originating from that FID.
473 * If d_id is non-zero, reset only exchanges sending to that FID.
474 */
475 void (*exch_mgr_reset)(struct fc_exch_mgr *,
476 u32 s_id, u32 d_id);
477
478 void (*rport_flush_queue)(void);
479 /**
480 * Local Port interfaces
481 */
482
483 /*
484 * Receive a frame to a local port.
485 */
486 void (*lport_recv)(struct fc_lport *lp, struct fc_seq *sp,
487 struct fc_frame *fp);
488
489 int (*lport_reset)(struct fc_lport *);
490
491 /**
492 * Remote Port interfaces
493 */
494
495 /*
496 * Initiates the RP state machine. It is called from the LP module.
497 * This function will issue the following commands to the N_Port
498 * identified by the FC ID provided.
499 *
500 * - PLOGI
501 * - PRLI
502 * - RTV
503 */
504 int (*rport_login)(struct fc_rport *rport);
505
506 /*
507 * Logoff, and remove the rport from the transport if
508 * it had been added. This will send a LOGO to the target.
509 */
510 int (*rport_logoff)(struct fc_rport *rport);
511
512 /*
513 * Recieve a request from a remote port.
514 */
515 void (*rport_recv_req)(struct fc_seq *, struct fc_frame *,
516 struct fc_rport *);
517
518 struct fc_rport *(*rport_lookup)(const struct fc_lport *, u32);
519
520 /**
521 * FCP interfaces
522 */
523
524 /*
525 * Send a fcp cmd from fsp pkt.
526 * Called with the SCSI host lock unlocked and irqs disabled.
527 *
528 * The resp handler is called when FCP_RSP received.
529 *
530 */
531 int (*fcp_cmd_send)(struct fc_lport *lp, struct fc_fcp_pkt *fsp,
532 void (*resp)(struct fc_seq *, struct fc_frame *fp,
533 void *arg));
534
535 /*
536 * Used at least durring linkdown and reset
537 */
538 void (*fcp_cleanup)(struct fc_lport *lp);
539
540 /*
541 * Abort all I/O on a local port
542 */
543 void (*fcp_abort_io)(struct fc_lport *lp);
544
545 /**
546 * Discovery interfaces
547 */
548
549 void (*disc_recv_req)(struct fc_seq *,
550 struct fc_frame *, struct fc_lport *);
551
552 /*
553 * Start discovery for a local port.
554 */
555 void (*disc_start)(void (*disc_callback)(struct fc_lport *,
556 enum fc_disc_event),
557 struct fc_lport *);
558
559 /*
560 * Stop discovery for a given lport. This will remove
561 * all discovered rports
562 */
563 void (*disc_stop) (struct fc_lport *);
564
565 /*
566 * Stop discovery for a given lport. This will block
567 * until all discovered rports are deleted from the
568 * FC transport class
569 */
570 void (*disc_stop_final) (struct fc_lport *);
571};
572
573/* information used by the discovery layer */
574struct fc_disc {
575 unsigned char retry_count;
576 unsigned char delay;
577 unsigned char pending;
578 unsigned char requested;
579 unsigned short seq_count;
580 unsigned char buf_len;
581 enum fc_disc_event event;
582
583 void (*disc_callback)(struct fc_lport *,
584 enum fc_disc_event);
585
586 struct list_head rports;
587 struct fc_lport *lport;
588 struct mutex disc_mutex;
589 struct fc_gpn_ft_resp partial_buf; /* partial name buffer */
590 struct delayed_work disc_work;
591};
592
593struct fc_lport {
594 struct list_head list;
595
596 /* Associations */
597 struct Scsi_Host *host;
598 struct fc_exch_mgr *emp;
599 struct fc_rport *dns_rp;
600 struct fc_rport *ptp_rp;
601 void *scsi_priv;
602 struct fc_disc disc;
603
604 /* Operational Information */
605 struct libfc_function_template tt;
606 u16 link_status;
607 enum fc_lport_state state;
608 unsigned long boot_time;
609
610 struct fc_host_statistics host_stats;
611 struct fcoe_dev_stats *dev_stats[NR_CPUS];
612 u64 wwpn;
613 u64 wwnn;
614 u8 retry_count;
615
616 /* Capabilities */
617 u32 sg_supp:1; /* scatter gather supported */
618 u32 seq_offload:1; /* seq offload supported */
619 u32 crc_offload:1; /* crc offload supported */
620 u32 lro_enabled:1; /* large receive offload */
621 u32 mfs; /* max FC payload size */
622 unsigned int service_params;
623 unsigned int e_d_tov;
624 unsigned int r_a_tov;
625 u8 max_retry_count;
626 u16 link_speed;
627 u16 link_supported_speeds;
628 u16 lro_xid; /* max xid for fcoe lro */
629 struct fc_ns_fts fcts; /* FC-4 type masks */
630 struct fc_els_rnid_gen rnid_gen; /* RNID information */
631
632 /* Semaphores */
633 struct mutex lp_mutex;
634
635 /* Miscellaneous */
636 struct delayed_work retry_work;
637 struct delayed_work disc_work;
638};
639
640/**
641 * FC_LPORT HELPER FUNCTIONS
642 *****************************/
643static inline void *lport_priv(const struct fc_lport *lp)
644{
645 return (void *)(lp + 1);
646}
647
648static inline int fc_lport_test_ready(struct fc_lport *lp)
649{
650 return lp->state == LPORT_ST_READY;
651}
652
653static inline void fc_set_wwnn(struct fc_lport *lp, u64 wwnn)
654{
655 lp->wwnn = wwnn;
656}
657
658static inline void fc_set_wwpn(struct fc_lport *lp, u64 wwnn)
659{
660 lp->wwpn = wwnn;
661}
662
663static inline void fc_lport_state_enter(struct fc_lport *lp,
664 enum fc_lport_state state)
665{
666 if (state != lp->state)
667 lp->retry_count = 0;
668 lp->state = state;
669}
670
671
672/**
673 * LOCAL PORT LAYER
674 *****************************/
675int fc_lport_init(struct fc_lport *lp);
676
677/*
678 * Destroy the specified local port by finding and freeing all
679 * fc_rports associated with it and then by freeing the fc_lport
680 * itself.
681 */
682int fc_lport_destroy(struct fc_lport *lp);
683
684/*
685 * Logout the specified local port from the fabric
686 */
687int fc_fabric_logoff(struct fc_lport *lp);
688
689/*
690 * Initiate the LP state machine. This handler will use fc_host_attr
691 * to store the FLOGI service parameters, so fc_host_attr must be
692 * initialized before calling this handler.
693 */
694int fc_fabric_login(struct fc_lport *lp);
695
696/*
697 * The link is up for the given local port.
698 */
699void fc_linkup(struct fc_lport *);
700
701/*
702 * Link is down for the given local port.
703 */
704void fc_linkdown(struct fc_lport *);
705
706/*
707 * Pause and unpause traffic.
708 */
709void fc_pause(struct fc_lport *);
710void fc_unpause(struct fc_lport *);
711
712/*
713 * Configure the local port.
714 */
715int fc_lport_config(struct fc_lport *);
716
717/*
718 * Reset the local port.
719 */
720int fc_lport_reset(struct fc_lport *);
721
722/*
723 * Set the mfs or reset
724 */
725int fc_set_mfs(struct fc_lport *lp, u32 mfs);
726
727
728/**
729 * REMOTE PORT LAYER
730 *****************************/
731int fc_rport_init(struct fc_lport *lp);
732void fc_rport_terminate_io(struct fc_rport *rp);
733
734/**
735 * DISCOVERY LAYER
736 *****************************/
737int fc_disc_init(struct fc_lport *lp);
738
739
740/**
741 * SCSI LAYER
742 *****************************/
743/*
744 * Initialize the SCSI block of libfc
745 */
746int fc_fcp_init(struct fc_lport *);
747
748/*
749 * This section provides an API which allows direct interaction
750 * with the SCSI-ml. Each of these functions satisfies a function
751 * pointer defined in Scsi_Host and therefore is always called
752 * directly from the SCSI-ml.
753 */
754int fc_queuecommand(struct scsi_cmnd *sc_cmd,
755 void (*done)(struct scsi_cmnd *));
756
757/*
758 * complete processing of a fcp packet
759 *
760 * This function may sleep if a fsp timer is pending.
761 * The host lock must not be held by caller.
762 */
763void fc_fcp_complete(struct fc_fcp_pkt *fsp);
764
765/*
766 * Send an ABTS frame to the target device. The sc_cmd argument
767 * is a pointer to the SCSI command to be aborted.
768 */
769int fc_eh_abort(struct scsi_cmnd *sc_cmd);
770
771/*
772 * Reset a LUN by sending send the tm cmd to the target.
773 */
774int fc_eh_device_reset(struct scsi_cmnd *sc_cmd);
775
776/*
777 * Reset the host adapter.
778 */
779int fc_eh_host_reset(struct scsi_cmnd *sc_cmd);
780
781/*
782 * Check rport status.
783 */
784int fc_slave_alloc(struct scsi_device *sdev);
785
786/*
787 * Adjust the queue depth.
788 */
789int fc_change_queue_depth(struct scsi_device *sdev, int qdepth);
790
791/*
792 * Change the tag type.
793 */
794int fc_change_queue_type(struct scsi_device *sdev, int tag_type);
795
796/*
797 * Free memory pools used by the FCP layer.
798 */
799void fc_fcp_destroy(struct fc_lport *);
800
801/**
802 * ELS/CT interface
803 *****************************/
804/*
805 * Initializes ELS/CT interface
806 */
807int fc_elsct_init(struct fc_lport *lp);
808
809
810/**
811 * EXCHANGE MANAGER LAYER
812 *****************************/
813/*
814 * Initializes Exchange Manager related
815 * function pointers in struct libfc_function_template.
816 */
817int fc_exch_init(struct fc_lport *lp);
818
819/*
820 * Allocates an Exchange Manager (EM).
821 *
822 * The EM manages exchanges for their allocation and
823 * free, also allows exchange lookup for received
824 * frame.
825 *
826 * The class is used for initializing FC class of
827 * allocated exchange from EM.
828 *
829 * The min_xid and max_xid will limit new
830 * exchange ID (XID) within this range for
831 * a new exchange.
832 * The LLD may choose to have multiple EMs,
833 * e.g. one EM instance per CPU receive thread in LLD.
834 * The LLD can use exch_get() of struct libfc_function_template
835 * to specify XID for a new exchange within
836 * a specified EM instance.
837 *
838 * The em_idx to uniquely identify an EM instance.
839 */
840struct fc_exch_mgr *fc_exch_mgr_alloc(struct fc_lport *lp,
841 enum fc_class class,
842 u16 min_xid,
843 u16 max_xid);
844
845/*
846 * Free an exchange manager.
847 */
848void fc_exch_mgr_free(struct fc_exch_mgr *mp);
849
850/*
851 * Receive a frame on specified local port and exchange manager.
852 */
853void fc_exch_recv(struct fc_lport *lp, struct fc_exch_mgr *mp,
854 struct fc_frame *fp);
855
856/*
857 * This function is for exch_seq_send function pointer in
858 * struct libfc_function_template, see comment block on
859 * exch_seq_send for description of this function.
860 */
861struct fc_seq *fc_exch_seq_send(struct fc_lport *lp,
862 struct fc_frame *fp,
863 void (*resp)(struct fc_seq *sp,
864 struct fc_frame *fp,
865 void *arg),
866 void (*destructor)(struct fc_seq *sp,
867 void *arg),
868 void *arg, u32 timer_msec);
869
870/*
871 * send a frame using existing sequence and exchange.
872 */
873int fc_seq_send(struct fc_lport *lp, struct fc_seq *sp, struct fc_frame *fp);
874
875/*
876 * Send ELS response using mainly infomation
877 * in exchange and sequence in EM layer.
878 */
879void fc_seq_els_rsp_send(struct fc_seq *sp, enum fc_els_cmd els_cmd,
880 struct fc_seq_els_data *els_data);
881
882/*
883 * This function is for seq_exch_abort function pointer in
884 * struct libfc_function_template, see comment block on
885 * seq_exch_abort for description of this function.
886 */
887int fc_seq_exch_abort(const struct fc_seq *req_sp, unsigned int timer_msec);
888
889/*
890 * Indicate that an exchange/sequence tuple is complete and the memory
891 * allocated for the related objects may be freed.
892 */
893void fc_exch_done(struct fc_seq *sp);
894
895/*
896 * Assigns a EM and XID for a frame and then allocates
897 * a new exchange and sequence pair.
898 * The fp can be used to determine free XID.
899 */
900struct fc_exch *fc_exch_get(struct fc_lport *lp, struct fc_frame *fp);
901
902/*
903 * Allocate a new exchange and sequence pair.
904 * if ex_id is zero then next free exchange id
905 * from specified exchange manger mp will be assigned.
906 */
907struct fc_exch *fc_exch_alloc(struct fc_exch_mgr *mp,
908 struct fc_frame *fp, u16 ex_id);
909/*
910 * Start a new sequence on the same exchange as the supplied sequence.
911 */
912struct fc_seq *fc_seq_start_next(struct fc_seq *sp);
913
914/*
915 * Reset an exchange manager, completing all sequences and exchanges.
916 * If s_id is non-zero, reset only exchanges originating from that FID.
917 * If d_id is non-zero, reset only exchanges sending to that FID.
918 */
919void fc_exch_mgr_reset(struct fc_exch_mgr *, u32 s_id, u32 d_id);
920
921/*
922 * Functions for fc_functions_template
923 */
924void fc_get_host_speed(struct Scsi_Host *shost);
925void fc_get_host_port_type(struct Scsi_Host *shost);
926void fc_get_host_port_state(struct Scsi_Host *shost);
927void fc_set_rport_loss_tmo(struct fc_rport *rport, u32 timeout);
928struct fc_host_statistics *fc_get_host_stats(struct Scsi_Host *);
929
930/*
931 * module setup functions.
932 */
933int fc_setup_exch_mgr(void);
934void fc_destroy_exch_mgr(void);
935int fc_setup_rport(void);
936void fc_destroy_rport(void);
937
938#endif /* _LIBFC_H_ */
diff --git a/include/scsi/libfcoe.h b/include/scsi/libfcoe.h
new file mode 100644
index 00000000000..89fdbb9a6a1
--- /dev/null
+++ b/include/scsi/libfcoe.h
@@ -0,0 +1,176 @@
1/*
2 * Copyright(c) 2007 - 2008 Intel Corporation. All rights reserved.
3 *
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,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
16 *
17 * Maintained at www.Open-FCoE.org
18 */
19
20#ifndef _LIBFCOE_H
21#define _LIBFCOE_H
22
23#include <linux/netdevice.h>
24#include <linux/skbuff.h>
25#include <scsi/fc/fc_fcoe.h>
26#include <scsi/libfc.h>
27
28/*
29 * this percpu struct for fcoe
30 */
31struct fcoe_percpu_s {
32 int cpu;
33 struct task_struct *thread;
34 struct sk_buff_head fcoe_rx_list;
35 struct page *crc_eof_page;
36 int crc_eof_offset;
37};
38
39/*
40 * the fcoe sw transport private data
41 */
42struct fcoe_softc {
43 struct list_head list;
44 struct fc_lport *lp;
45 struct net_device *real_dev;
46 struct net_device *phys_dev; /* device with ethtool_ops */
47 struct packet_type fcoe_packet_type;
48 struct sk_buff_head fcoe_pending_queue;
49
50 u8 dest_addr[ETH_ALEN];
51 u8 ctl_src_addr[ETH_ALEN];
52 u8 data_src_addr[ETH_ALEN];
53 /*
54 * fcoe protocol address learning related stuff
55 */
56 u16 flogi_oxid;
57 u8 flogi_progress;
58 u8 address_mode;
59};
60
61static inline struct fcoe_softc *fcoe_softc(
62 const struct fc_lport *lp)
63{
64 return (struct fcoe_softc *)lport_priv(lp);
65}
66
67static inline struct net_device *fcoe_netdev(
68 const struct fc_lport *lp)
69{
70 return fcoe_softc(lp)->real_dev;
71}
72
73static inline struct fcoe_hdr *skb_fcoe_header(const struct sk_buff *skb)
74{
75 return (struct fcoe_hdr *)skb_network_header(skb);
76}
77
78static inline int skb_fcoe_offset(const struct sk_buff *skb)
79{
80 return skb_network_offset(skb);
81}
82
83static inline struct fc_frame_header *skb_fc_header(const struct sk_buff *skb)
84{
85 return (struct fc_frame_header *)skb_transport_header(skb);
86}
87
88static inline int skb_fc_offset(const struct sk_buff *skb)
89{
90 return skb_transport_offset(skb);
91}
92
93static inline void skb_reset_fc_header(struct sk_buff *skb)
94{
95 skb_reset_network_header(skb);
96 skb_set_transport_header(skb, skb_network_offset(skb) +
97 sizeof(struct fcoe_hdr));
98}
99
100static inline bool skb_fc_is_data(const struct sk_buff *skb)
101{
102 return skb_fc_header(skb)->fh_r_ctl == FC_RCTL_DD_SOL_DATA;
103}
104
105static inline bool skb_fc_is_cmd(const struct sk_buff *skb)
106{
107 return skb_fc_header(skb)->fh_r_ctl == FC_RCTL_DD_UNSOL_CMD;
108}
109
110static inline bool skb_fc_has_exthdr(const struct sk_buff *skb)
111{
112 return (skb_fc_header(skb)->fh_r_ctl == FC_RCTL_VFTH) ||
113 (skb_fc_header(skb)->fh_r_ctl == FC_RCTL_IFRH) ||
114 (skb_fc_header(skb)->fh_r_ctl == FC_RCTL_ENCH);
115}
116
117static inline bool skb_fc_is_roff(const struct sk_buff *skb)
118{
119 return skb_fc_header(skb)->fh_f_ctl[2] & FC_FC_REL_OFF;
120}
121
122static inline u16 skb_fc_oxid(const struct sk_buff *skb)
123{
124 return be16_to_cpu(skb_fc_header(skb)->fh_ox_id);
125}
126
127static inline u16 skb_fc_rxid(const struct sk_buff *skb)
128{
129 return be16_to_cpu(skb_fc_header(skb)->fh_rx_id);
130}
131
132/* FIXME - DMA_BIDIRECTIONAL ? */
133#define skb_cb(skb) ((struct fcoe_rcv_info *)&((skb)->cb[0]))
134#define skb_cmd(skb) (skb_cb(skb)->fr_cmd)
135#define skb_dir(skb) (skb_cmd(skb)->sc_data_direction)
136static inline bool skb_fc_is_read(const struct sk_buff *skb)
137{
138 if (skb_fc_is_cmd(skb) && skb_cmd(skb))
139 return skb_dir(skb) == DMA_FROM_DEVICE;
140 return false;
141}
142
143static inline bool skb_fc_is_write(const struct sk_buff *skb)
144{
145 if (skb_fc_is_cmd(skb) && skb_cmd(skb))
146 return skb_dir(skb) == DMA_TO_DEVICE;
147 return false;
148}
149
150/* libfcoe funcs */
151int fcoe_reset(struct Scsi_Host *shost);
152u64 fcoe_wwn_from_mac(unsigned char mac[MAX_ADDR_LEN],
153 unsigned int scheme, unsigned int port);
154
155u32 fcoe_fc_crc(struct fc_frame *fp);
156int fcoe_xmit(struct fc_lport *, struct fc_frame *);
157int fcoe_rcv(struct sk_buff *, struct net_device *,
158 struct packet_type *, struct net_device *);
159
160int fcoe_percpu_receive_thread(void *arg);
161void fcoe_clean_pending_queue(struct fc_lport *lp);
162void fcoe_percpu_clean(struct fc_lport *lp);
163void fcoe_watchdog(ulong vp);
164int fcoe_link_ok(struct fc_lport *lp);
165
166struct fc_lport *fcoe_hostlist_lookup(const struct net_device *);
167int fcoe_hostlist_add(const struct fc_lport *);
168int fcoe_hostlist_remove(const struct fc_lport *);
169
170struct Scsi_Host *fcoe_host_alloc(struct scsi_host_template *, int);
171int fcoe_libfc_config(struct fc_lport *, struct libfc_function_template *);
172
173/* fcoe sw hba */
174int __init fcoe_sw_init(void);
175int __exit fcoe_sw_exit(void);
176#endif /* _LIBFCOE_H */
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
index 61e53f14f7e..7360e1916e7 100644
--- a/include/scsi/libiscsi.h
+++ b/include/scsi/libiscsi.h
@@ -30,6 +30,7 @@
30#include <linux/workqueue.h> 30#include <linux/workqueue.h>
31#include <scsi/iscsi_proto.h> 31#include <scsi/iscsi_proto.h>
32#include <scsi/iscsi_if.h> 32#include <scsi/iscsi_if.h>
33#include <scsi/scsi_transport_iscsi.h>
33 34
34struct scsi_transport_template; 35struct scsi_transport_template;
35struct scsi_host_template; 36struct scsi_host_template;
@@ -70,12 +71,12 @@ enum {
70/* Connection suspend "bit" */ 71/* Connection suspend "bit" */
71#define ISCSI_SUSPEND_BIT 1 72#define ISCSI_SUSPEND_BIT 1
72 73
73#define ISCSI_ITT_MASK (0x1fff) 74#define ISCSI_ITT_MASK 0x1fff
74#define ISCSI_TOTAL_CMDS_MAX 4096 75#define ISCSI_TOTAL_CMDS_MAX 4096
75/* this must be a power of two greater than ISCSI_MGMT_CMDS_MAX */ 76/* this must be a power of two greater than ISCSI_MGMT_CMDS_MAX */
76#define ISCSI_TOTAL_CMDS_MIN 16 77#define ISCSI_TOTAL_CMDS_MIN 16
77#define ISCSI_AGE_SHIFT 28 78#define ISCSI_AGE_SHIFT 28
78#define ISCSI_AGE_MASK (0xf << ISCSI_AGE_SHIFT) 79#define ISCSI_AGE_MASK 0xf
79 80
80#define ISCSI_ADDRESS_BUF_LEN 64 81#define ISCSI_ADDRESS_BUF_LEN 64
81 82
@@ -93,24 +94,38 @@ enum {
93 ISCSI_TASK_RUNNING, 94 ISCSI_TASK_RUNNING,
94}; 95};
95 96
97struct iscsi_r2t_info {
98 __be32 ttt; /* copied from R2T */
99 __be32 exp_statsn; /* copied from R2T */
100 uint32_t data_length; /* copied from R2T */
101 uint32_t data_offset; /* copied from R2T */
102 int data_count; /* DATA-Out payload progress */
103 int datasn;
104 /* LLDs should set/update these values */
105 int sent; /* R2T sequence progress */
106};
107
96struct iscsi_task { 108struct iscsi_task {
97 /* 109 /*
98 * Because LLDs allocate their hdr differently, this is a pointer 110 * Because LLDs allocate their hdr differently, this is a pointer
99 * and length to that storage. It must be setup at session 111 * and length to that storage. It must be setup at session
100 * creation time. 112 * creation time.
101 */ 113 */
102 struct iscsi_cmd *hdr; 114 struct iscsi_hdr *hdr;
103 unsigned short hdr_max; 115 unsigned short hdr_max;
104 unsigned short hdr_len; /* accumulated size of hdr used */ 116 unsigned short hdr_len; /* accumulated size of hdr used */
117 /* copied values in case we need to send tmfs */
118 itt_t hdr_itt;
119 __be32 cmdsn;
120 uint8_t lun[8];
121
105 int itt; /* this ITT */ 122 int itt; /* this ITT */
106 123
107 uint32_t unsol_datasn;
108 unsigned imm_count; /* imm-data (bytes) */ 124 unsigned imm_count; /* imm-data (bytes) */
109 unsigned unsol_count; /* unsolicited (bytes)*/
110 /* offset in unsolicited stream (bytes); */ 125 /* offset in unsolicited stream (bytes); */
111 unsigned unsol_offset; 126 struct iscsi_r2t_info unsol_r2t;
112 unsigned data_count; /* remaining Data-Out */
113 char *data; /* mgmt payload */ 127 char *data; /* mgmt payload */
128 unsigned data_count;
114 struct scsi_cmnd *sc; /* associated SCSI cmd*/ 129 struct scsi_cmnd *sc; /* associated SCSI cmd*/
115 struct iscsi_conn *conn; /* used connection */ 130 struct iscsi_conn *conn; /* used connection */
116 131
@@ -121,6 +136,11 @@ struct iscsi_task {
121 void *dd_data; /* driver/transport data */ 136 void *dd_data; /* driver/transport data */
122}; 137};
123 138
139static inline int iscsi_task_has_unsol_data(struct iscsi_task *task)
140{
141 return task->unsol_r2t.data_length > task->unsol_r2t.sent;
142}
143
124static inline void* iscsi_next_hdr(struct iscsi_task *task) 144static inline void* iscsi_next_hdr(struct iscsi_task *task)
125{ 145{
126 return (void*)task->hdr + task->hdr_len; 146 return (void*)task->hdr + task->hdr_len;
@@ -376,8 +396,9 @@ extern void iscsi_suspend_tx(struct iscsi_conn *conn);
376 * pdu and task processing 396 * pdu and task processing
377 */ 397 */
378extern void iscsi_update_cmdsn(struct iscsi_session *, struct iscsi_nopin *); 398extern void iscsi_update_cmdsn(struct iscsi_session *, struct iscsi_nopin *);
379extern void iscsi_prep_unsolicit_data_pdu(struct iscsi_task *, 399extern void iscsi_prep_data_out_pdu(struct iscsi_task *task,
380 struct iscsi_data *hdr); 400 struct iscsi_r2t_info *r2t,
401 struct iscsi_data *hdr);
381extern int iscsi_conn_send_pdu(struct iscsi_cls_conn *, struct iscsi_hdr *, 402extern int iscsi_conn_send_pdu(struct iscsi_cls_conn *, struct iscsi_hdr *,
382 char *, uint32_t); 403 char *, uint32_t);
383extern int iscsi_complete_pdu(struct iscsi_conn *, struct iscsi_hdr *, 404extern int iscsi_complete_pdu(struct iscsi_conn *, struct iscsi_hdr *,
diff --git a/include/scsi/libiscsi_tcp.h b/include/scsi/libiscsi_tcp.h
new file mode 100644
index 00000000000..83e32f6d785
--- /dev/null
+++ b/include/scsi/libiscsi_tcp.h
@@ -0,0 +1,132 @@
1/*
2 * iSCSI over TCP/IP Data-Path lib
3 *
4 * Copyright (C) 2008 Mike Christie
5 * Copyright (C) 2008 Red Hat, Inc. All rights reserved.
6 * maintained by open-iscsi@googlegroups.com
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published
10 * by the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * See the file COPYING included with this distribution for more details.
19 */
20
21#ifndef LIBISCSI_TCP_H
22#define LIBISCSI_TCP_H
23
24#include <scsi/libiscsi.h>
25
26struct iscsi_tcp_conn;
27struct iscsi_segment;
28struct sk_buff;
29struct hash_desc;
30
31typedef int iscsi_segment_done_fn_t(struct iscsi_tcp_conn *,
32 struct iscsi_segment *);
33
34struct iscsi_segment {
35 unsigned char *data;
36 unsigned int size;
37 unsigned int copied;
38 unsigned int total_size;
39 unsigned int total_copied;
40
41 struct hash_desc *hash;
42 unsigned char recv_digest[ISCSI_DIGEST_SIZE];
43 unsigned char digest[ISCSI_DIGEST_SIZE];
44 unsigned int digest_len;
45
46 struct scatterlist *sg;
47 void *sg_mapped;
48 unsigned int sg_offset;
49
50 iscsi_segment_done_fn_t *done;
51};
52
53/* Socket connection recieve helper */
54struct iscsi_tcp_recv {
55 struct iscsi_hdr *hdr;
56 struct iscsi_segment segment;
57
58 /* Allocate buffer for BHS + AHS */
59 uint32_t hdr_buf[64];
60
61 /* copied and flipped values */
62 int datalen;
63};
64
65struct iscsi_tcp_conn {
66 struct iscsi_conn *iscsi_conn;
67 void *dd_data;
68 int stop_stage; /* conn_stop() flag: *
69 * stop to recover, *
70 * stop to terminate */
71 /* control data */
72 struct iscsi_tcp_recv in; /* TCP receive context */
73 /* CRC32C (Rx) LLD should set this is they do not offload */
74 struct hash_desc *rx_hash;
75};
76
77struct iscsi_tcp_task {
78 uint32_t exp_datasn; /* expected target's R2TSN/DataSN */
79 int data_offset;
80 struct iscsi_r2t_info *r2t; /* in progress solict R2T */
81 struct iscsi_pool r2tpool;
82 struct kfifo *r2tqueue;
83 void *dd_data;
84};
85
86enum {
87 ISCSI_TCP_SEGMENT_DONE, /* curr seg has been processed */
88 ISCSI_TCP_SKB_DONE, /* skb is out of data */
89 ISCSI_TCP_CONN_ERR, /* iscsi layer has fired a conn err */
90 ISCSI_TCP_SUSPENDED, /* conn is suspended */
91};
92
93extern void iscsi_tcp_hdr_recv_prep(struct iscsi_tcp_conn *tcp_conn);
94extern int iscsi_tcp_recv_skb(struct iscsi_conn *conn, struct sk_buff *skb,
95 unsigned int offset, bool offloaded, int *status);
96extern void iscsi_tcp_cleanup_task(struct iscsi_task *task);
97extern int iscsi_tcp_task_init(struct iscsi_task *task);
98extern int iscsi_tcp_task_xmit(struct iscsi_task *task);
99
100/* segment helpers */
101extern int iscsi_tcp_recv_segment_is_hdr(struct iscsi_tcp_conn *tcp_conn);
102extern int iscsi_tcp_segment_done(struct iscsi_tcp_conn *tcp_conn,
103 struct iscsi_segment *segment, int recv,
104 unsigned copied);
105extern void iscsi_tcp_segment_unmap(struct iscsi_segment *segment);
106
107extern void iscsi_segment_init_linear(struct iscsi_segment *segment,
108 void *data, size_t size,
109 iscsi_segment_done_fn_t *done,
110 struct hash_desc *hash);
111extern int
112iscsi_segment_seek_sg(struct iscsi_segment *segment,
113 struct scatterlist *sg_list, unsigned int sg_count,
114 unsigned int offset, size_t size,
115 iscsi_segment_done_fn_t *done, struct hash_desc *hash);
116
117/* digest helpers */
118extern void iscsi_tcp_dgst_header(struct hash_desc *hash, const void *hdr,
119 size_t hdrlen,
120 unsigned char digest[ISCSI_DIGEST_SIZE]);
121extern struct iscsi_cls_conn *
122iscsi_tcp_conn_setup(struct iscsi_cls_session *cls_session, int dd_data_size,
123 uint32_t conn_idx);
124extern void iscsi_tcp_conn_teardown(struct iscsi_cls_conn *cls_conn);
125
126/* misc helpers */
127extern int iscsi_tcp_r2tpool_alloc(struct iscsi_session *session);
128extern void iscsi_tcp_r2tpool_free(struct iscsi_session *session);
129
130extern void iscsi_tcp_conn_get_stats(struct iscsi_cls_conn *cls_conn,
131 struct iscsi_stats *stats);
132#endif /* LIBISCSI_TCP_H */
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index a37a8148a31..01a4c58f8ba 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -159,8 +159,6 @@ struct scsi_device {
159 atomic_t iodone_cnt; 159 atomic_t iodone_cnt;
160 atomic_t ioerr_cnt; 160 atomic_t ioerr_cnt;
161 161
162 int timeout;
163
164 struct device sdev_gendev, 162 struct device sdev_gendev,
165 sdev_dev; 163 sdev_dev;
166 164
@@ -367,10 +365,11 @@ extern int scsi_is_target_device(const struct device *);
367extern int scsi_execute(struct scsi_device *sdev, const unsigned char *cmd, 365extern int scsi_execute(struct scsi_device *sdev, const unsigned char *cmd,
368 int data_direction, void *buffer, unsigned bufflen, 366 int data_direction, void *buffer, unsigned bufflen,
369 unsigned char *sense, int timeout, int retries, 367 unsigned char *sense, int timeout, int retries,
370 int flag); 368 int flag, int *resid);
371extern int scsi_execute_req(struct scsi_device *sdev, const unsigned char *cmd, 369extern int scsi_execute_req(struct scsi_device *sdev, const unsigned char *cmd,
372 int data_direction, void *buffer, unsigned bufflen, 370 int data_direction, void *buffer, unsigned bufflen,
373 struct scsi_sense_hdr *, int timeout, int retries); 371 struct scsi_sense_hdr *, int timeout, int retries,
372 int *resid);
374extern int scsi_execute_async(struct scsi_device *sdev, 373extern int scsi_execute_async(struct scsi_device *sdev,
375 const unsigned char *cmd, int cmd_len, int data_direction, 374 const unsigned char *cmd, int cmd_len, int data_direction,
376 void *buffer, unsigned bufflen, int use_sg, 375 void *buffer, unsigned bufflen, int use_sg,
diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h
index c667cc39654..b50aabe2861 100644
--- a/include/scsi/scsi_transport_iscsi.h
+++ b/include/scsi/scsi_transport_iscsi.h
@@ -113,10 +113,18 @@ struct iscsi_transport {
113 char *data, uint32_t data_size); 113 char *data, uint32_t data_size);
114 void (*get_stats) (struct iscsi_cls_conn *conn, 114 void (*get_stats) (struct iscsi_cls_conn *conn,
115 struct iscsi_stats *stats); 115 struct iscsi_stats *stats);
116
116 int (*init_task) (struct iscsi_task *task); 117 int (*init_task) (struct iscsi_task *task);
117 int (*xmit_task) (struct iscsi_task *task); 118 int (*xmit_task) (struct iscsi_task *task);
118 void (*cleanup_task) (struct iscsi_conn *conn, 119 void (*cleanup_task) (struct iscsi_task *task);
119 struct iscsi_task *task); 120
121 int (*alloc_pdu) (struct iscsi_task *task, uint8_t opcode);
122 int (*xmit_pdu) (struct iscsi_task *task);
123 int (*init_pdu) (struct iscsi_task *task, unsigned int offset,
124 unsigned int count);
125 void (*parse_pdu_itt) (struct iscsi_conn *conn, itt_t itt,
126 int *index, int *age);
127
120 void (*session_recovery_timedout) (struct iscsi_cls_session *session); 128 void (*session_recovery_timedout) (struct iscsi_cls_session *session);
121 struct iscsi_endpoint *(*ep_connect) (struct sockaddr *dst_addr, 129 struct iscsi_endpoint *(*ep_connect) (struct sockaddr *dst_addr,
122 int non_blocking); 130 int non_blocking);
diff --git a/include/sound/ac97_codec.h b/include/sound/ac97_codec.h
index 9c309daf492..251fc1cd500 100644
--- a/include/sound/ac97_codec.h
+++ b/include/sound/ac97_codec.h
@@ -281,10 +281,12 @@
281/* specific - Analog Devices */ 281/* specific - Analog Devices */
282#define AC97_AD_TEST 0x5a /* test register */ 282#define AC97_AD_TEST 0x5a /* test register */
283#define AC97_AD_TEST2 0x5c /* undocumented test register 2 */ 283#define AC97_AD_TEST2 0x5c /* undocumented test register 2 */
284#define AC97_AD_HPFD_SHIFT 12 /* High Pass Filter Disable */
284#define AC97_AD_CODEC_CFG 0x70 /* codec configuration */ 285#define AC97_AD_CODEC_CFG 0x70 /* codec configuration */
285#define AC97_AD_JACK_SPDIF 0x72 /* Jack Sense & S/PDIF */ 286#define AC97_AD_JACK_SPDIF 0x72 /* Jack Sense & S/PDIF */
286#define AC97_AD_SERIAL_CFG 0x74 /* Serial Configuration */ 287#define AC97_AD_SERIAL_CFG 0x74 /* Serial Configuration */
287#define AC97_AD_MISC 0x76 /* Misc Control Bits */ 288#define AC97_AD_MISC 0x76 /* Misc Control Bits */
289#define AC97_AD_VREFD_SHIFT 2 /* V_REFOUT Disable (AD1888) */
288 290
289/* specific - Cirrus Logic */ 291/* specific - Cirrus Logic */
290#define AC97_CSR_ACMODE 0x5e /* AC Mode Register */ 292#define AC97_CSR_ACMODE 0x5e /* AC Mode Register */
diff --git a/include/sound/asound.h b/include/sound/asound.h
index 2c4dc908a54..1c02ed1d7c4 100644
--- a/include/sound/asound.h
+++ b/include/sound/asound.h
@@ -575,6 +575,7 @@ enum {
575#define SNDRV_TIMER_GLOBAL_SYSTEM 0 575#define SNDRV_TIMER_GLOBAL_SYSTEM 0
576#define SNDRV_TIMER_GLOBAL_RTC 1 576#define SNDRV_TIMER_GLOBAL_RTC 1
577#define SNDRV_TIMER_GLOBAL_HPET 2 577#define SNDRV_TIMER_GLOBAL_HPET 2
578#define SNDRV_TIMER_GLOBAL_HRTIMER 3
578 579
579/* info flags */ 580/* info flags */
580#define SNDRV_TIMER_FLG_SLAVE (1<<0) /* cannot be controlled */ 581#define SNDRV_TIMER_FLG_SLAVE (1<<0) /* cannot be controlled */
diff --git a/include/sound/core.h b/include/sound/core.h
index 1508c4ec1ba..f632484bc74 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -353,7 +353,7 @@ void snd_verbose_printd(const char *file, int line, const char *format, ...)
353 * snd_printk - printk wrapper 353 * snd_printk - printk wrapper
354 * @fmt: format string 354 * @fmt: format string
355 * 355 *
356 * Works like print() but prints the file and the line of the caller 356 * Works like printk() but prints the file and the line of the caller
357 * when configured with CONFIG_SND_VERBOSE_PRINTK. 357 * when configured with CONFIG_SND_VERBOSE_PRINTK.
358 */ 358 */
359#define snd_printk(fmt, args...) \ 359#define snd_printk(fmt, args...) \
@@ -380,18 +380,40 @@ void snd_verbose_printd(const char *file, int line, const char *format, ...)
380 printk(fmt ,##args) 380 printk(fmt ,##args)
381#endif 381#endif
382 382
383/**
384 * snd_BUG - give a BUG warning message and stack trace
385 *
386 * Calls WARN() if CONFIG_SND_DEBUG is set.
387 * Ignored when CONFIG_SND_DEBUG is not set.
388 */
383#define snd_BUG() WARN(1, "BUG?\n") 389#define snd_BUG() WARN(1, "BUG?\n")
390
391/**
392 * snd_BUG_ON - debugging check macro
393 * @cond: condition to evaluate
394 *
395 * When CONFIG_SND_DEBUG is set, this macro evaluates the given condition,
396 * and call WARN() and returns the value if it's non-zero.
397 *
398 * When CONFIG_SND_DEBUG is not set, this just returns zero, and the given
399 * condition is ignored.
400 *
401 * NOTE: the argument won't be evaluated at all when CONFIG_SND_DEBUG=n.
402 * Thus, don't put any statement that influences on the code behavior,
403 * such as pre/post increment, to the argument of this macro.
404 * If you want to evaluate and give a warning, use standard WARN_ON().
405 */
384#define snd_BUG_ON(cond) WARN((cond), "BUG? (%s)\n", __stringify(cond)) 406#define snd_BUG_ON(cond) WARN((cond), "BUG? (%s)\n", __stringify(cond))
385 407
386#else /* !CONFIG_SND_DEBUG */ 408#else /* !CONFIG_SND_DEBUG */
387 409
388#define snd_printd(fmt, args...) do { } while (0) 410#define snd_printd(fmt, args...) do { } while (0)
389#define snd_BUG() do { } while (0) 411#define snd_BUG() do { } while (0)
390static inline int __snd_bug_on(void) 412static inline int __snd_bug_on(int cond)
391{ 413{
392 return 0; 414 return 0;
393} 415}
394#define snd_BUG_ON(cond) __snd_bug_on() /* always false */ 416#define snd_BUG_ON(cond) __snd_bug_on(0 && (cond)) /* always false */
395 417
396#endif /* CONFIG_SND_DEBUG */ 418#endif /* CONFIG_SND_DEBUG */
397 419
diff --git a/include/sound/info.h b/include/sound/info.h
index 8ae72e74f89..7c2ee1a21b0 100644
--- a/include/sound/info.h
+++ b/include/sound/info.h
@@ -40,30 +40,34 @@ struct snd_info_buffer {
40struct snd_info_entry; 40struct snd_info_entry;
41 41
42struct snd_info_entry_text { 42struct snd_info_entry_text {
43 void (*read) (struct snd_info_entry *entry, struct snd_info_buffer *buffer); 43 void (*read)(struct snd_info_entry *entry,
44 void (*write) (struct snd_info_entry *entry, struct snd_info_buffer *buffer); 44 struct snd_info_buffer *buffer);
45 void (*write)(struct snd_info_entry *entry,
46 struct snd_info_buffer *buffer);
45}; 47};
46 48
47struct snd_info_entry_ops { 49struct snd_info_entry_ops {
48 int (*open) (struct snd_info_entry *entry, 50 int (*open)(struct snd_info_entry *entry,
49 unsigned short mode, void **file_private_data); 51 unsigned short mode, void **file_private_data);
50 int (*release) (struct snd_info_entry * entry, 52 int (*release)(struct snd_info_entry *entry,
51 unsigned short mode, void *file_private_data); 53 unsigned short mode, void *file_private_data);
52 long (*read) (struct snd_info_entry *entry, void *file_private_data, 54 long (*read)(struct snd_info_entry *entry, void *file_private_data,
53 struct file * file, char __user *buf, 55 struct file *file, char __user *buf,
56 unsigned long count, unsigned long pos);
57 long (*write)(struct snd_info_entry *entry, void *file_private_data,
58 struct file *file, const char __user *buf,
54 unsigned long count, unsigned long pos); 59 unsigned long count, unsigned long pos);
55 long (*write) (struct snd_info_entry *entry, void *file_private_data, 60 long long (*llseek)(struct snd_info_entry *entry,
56 struct file * file, const char __user *buf, 61 void *file_private_data, struct file *file,
57 unsigned long count, unsigned long pos); 62 long long offset, int orig);
58 long long (*llseek) (struct snd_info_entry *entry, void *file_private_data, 63 unsigned int(*poll)(struct snd_info_entry *entry,
59 struct file * file, long long offset, int orig); 64 void *file_private_data, struct file *file,
60 unsigned int (*poll) (struct snd_info_entry *entry, void *file_private_data, 65 poll_table *wait);
61 struct file * file, poll_table * wait); 66 int (*ioctl)(struct snd_info_entry *entry, void *file_private_data,
62 int (*ioctl) (struct snd_info_entry *entry, void *file_private_data, 67 struct file *file, unsigned int cmd, unsigned long arg);
63 struct file * file, unsigned int cmd, unsigned long arg); 68 int (*mmap)(struct snd_info_entry *entry, void *file_private_data,
64 int (*mmap) (struct snd_info_entry *entry, void *file_private_data, 69 struct inode *inode, struct file *file,
65 struct inode * inode, struct file * file, 70 struct vm_area_struct *vma);
66 struct vm_area_struct * vma);
67}; 71};
68 72
69struct snd_info_entry { 73struct snd_info_entry {
@@ -106,34 +110,37 @@ void snd_card_info_read_oss(struct snd_info_buffer *buffer);
106static inline void snd_card_info_read_oss(struct snd_info_buffer *buffer) {} 110static inline void snd_card_info_read_oss(struct snd_info_buffer *buffer) {}
107#endif 111#endif
108 112
109int snd_iprintf(struct snd_info_buffer * buffer, char *fmt,...) __attribute__ ((format (printf, 2, 3))); 113int snd_iprintf(struct snd_info_buffer *buffer, char *fmt, ...) \
114 __attribute__ ((format (printf, 2, 3)));
110int snd_info_init(void); 115int snd_info_init(void);
111int snd_info_done(void); 116int snd_info_done(void);
112 117
113int snd_info_get_line(struct snd_info_buffer * buffer, char *line, int len); 118int snd_info_get_line(struct snd_info_buffer *buffer, char *line, int len);
114char *snd_info_get_str(char *dest, char *src, int len); 119char *snd_info_get_str(char *dest, char *src, int len);
115struct snd_info_entry *snd_info_create_module_entry(struct module * module, 120struct snd_info_entry *snd_info_create_module_entry(struct module *module,
116 const char *name, 121 const char *name,
117 struct snd_info_entry * parent); 122 struct snd_info_entry *parent);
118struct snd_info_entry *snd_info_create_card_entry(struct snd_card * card, 123struct snd_info_entry *snd_info_create_card_entry(struct snd_card *card,
119 const char *name, 124 const char *name,
120 struct snd_info_entry * parent); 125 struct snd_info_entry *parent);
121void snd_info_free_entry(struct snd_info_entry * entry); 126void snd_info_free_entry(struct snd_info_entry *entry);
122int snd_info_store_text(struct snd_info_entry * entry); 127int snd_info_store_text(struct snd_info_entry *entry);
123int snd_info_restore_text(struct snd_info_entry * entry); 128int snd_info_restore_text(struct snd_info_entry *entry);
124 129
125int snd_info_card_create(struct snd_card * card); 130int snd_info_card_create(struct snd_card *card);
126int snd_info_card_register(struct snd_card * card); 131int snd_info_card_register(struct snd_card *card);
127int snd_info_card_free(struct snd_card * card); 132int snd_info_card_free(struct snd_card *card);
128void snd_info_card_disconnect(struct snd_card * card); 133void snd_info_card_disconnect(struct snd_card *card);
129int snd_info_register(struct snd_info_entry * entry); 134void snd_info_card_id_change(struct snd_card *card);
135int snd_info_register(struct snd_info_entry *entry);
130 136
131/* for card drivers */ 137/* for card drivers */
132int snd_card_proc_new(struct snd_card *card, const char *name, struct snd_info_entry **entryp); 138int snd_card_proc_new(struct snd_card *card, const char *name,
139 struct snd_info_entry **entryp);
133 140
134static inline void snd_info_set_text_ops(struct snd_info_entry *entry, 141static inline void snd_info_set_text_ops(struct snd_info_entry *entry,
135 void *private_data, 142 void *private_data,
136 void (*read)(struct snd_info_entry *, struct snd_info_buffer *)) 143 void (*read)(struct snd_info_entry *, struct snd_info_buffer *))
137{ 144{
138 entry->private_data = private_data; 145 entry->private_data = private_data;
139 entry->c.text.read = read; 146 entry->c.text.read = read;
@@ -146,21 +153,22 @@ int snd_info_check_reserved_words(const char *str);
146#define snd_seq_root NULL 153#define snd_seq_root NULL
147#define snd_oss_root NULL 154#define snd_oss_root NULL
148 155
149static inline int snd_iprintf(struct snd_info_buffer * buffer, char *fmt,...) { return 0; } 156static inline int snd_iprintf(struct snd_info_buffer *buffer, char *fmt, ...) { return 0; }
150static inline int snd_info_init(void) { return 0; } 157static inline int snd_info_init(void) { return 0; }
151static inline int snd_info_done(void) { return 0; } 158static inline int snd_info_done(void) { return 0; }
152 159
153static inline int snd_info_get_line(struct snd_info_buffer * buffer, char *line, int len) { return 0; } 160static inline int snd_info_get_line(struct snd_info_buffer *buffer, char *line, int len) { return 0; }
154static inline char *snd_info_get_str(char *dest, char *src, int len) { return NULL; } 161static inline char *snd_info_get_str(char *dest, char *src, int len) { return NULL; }
155static inline struct snd_info_entry *snd_info_create_module_entry(struct module * module, const char *name, struct snd_info_entry * parent) { return NULL; } 162static inline struct snd_info_entry *snd_info_create_module_entry(struct module *module, const char *name, struct snd_info_entry *parent) { return NULL; }
156static inline struct snd_info_entry *snd_info_create_card_entry(struct snd_card * card, const char *name, struct snd_info_entry * parent) { return NULL; } 163static inline struct snd_info_entry *snd_info_create_card_entry(struct snd_card *card, const char *name, struct snd_info_entry *parent) { return NULL; }
157static inline void snd_info_free_entry(struct snd_info_entry * entry) { ; } 164static inline void snd_info_free_entry(struct snd_info_entry *entry) { ; }
158 165
159static inline int snd_info_card_create(struct snd_card * card) { return 0; } 166static inline int snd_info_card_create(struct snd_card *card) { return 0; }
160static inline int snd_info_card_register(struct snd_card * card) { return 0; } 167static inline int snd_info_card_register(struct snd_card *card) { return 0; }
161static inline int snd_info_card_free(struct snd_card * card) { return 0; } 168static inline int snd_info_card_free(struct snd_card *card) { return 0; }
162static inline void snd_info_card_disconnect(struct snd_card * card) { } 169static inline void snd_info_card_disconnect(struct snd_card *card) { }
163static inline int snd_info_register(struct snd_info_entry * entry) { return 0; } 170static inline void snd_info_card_id_change(struct snd_card *card) { }
171static inline int snd_info_register(struct snd_info_entry *entry) { return 0; }
164 172
165static inline int snd_card_proc_new(struct snd_card *card, const char *name, 173static inline int snd_card_proc_new(struct snd_card *card, const char *name,
166 struct snd_info_entry **entryp) { return -EINVAL; } 174 struct snd_info_entry **entryp) { return -EINVAL; }
diff --git a/include/sound/jack.h b/include/sound/jack.h
index b1b2b8b59ad..2e0315cdd0d 100644
--- a/include/sound/jack.h
+++ b/include/sound/jack.h
@@ -35,6 +35,8 @@ enum snd_jack_types {
35 SND_JACK_HEADPHONE = 0x0001, 35 SND_JACK_HEADPHONE = 0x0001,
36 SND_JACK_MICROPHONE = 0x0002, 36 SND_JACK_MICROPHONE = 0x0002,
37 SND_JACK_HEADSET = SND_JACK_HEADPHONE | SND_JACK_MICROPHONE, 37 SND_JACK_HEADSET = SND_JACK_HEADPHONE | SND_JACK_MICROPHONE,
38 SND_JACK_LINEOUT = 0x0004,
39 SND_JACK_MECHANICAL = 0x0008, /* If detected separately */
38}; 40};
39 41
40struct snd_jack { 42struct snd_jack {
diff --git a/include/sound/l3.h b/include/sound/l3.h
new file mode 100644
index 00000000000..423a08f0f1b
--- /dev/null
+++ b/include/sound/l3.h
@@ -0,0 +1,18 @@
1#ifndef _L3_H_
2#define _L3_H_ 1
3
4struct l3_pins {
5 void (*setdat)(int);
6 void (*setclk)(int);
7 void (*setmode)(int);
8 int data_hold;
9 int data_setup;
10 int clock_high;
11 int mode_hold;
12 int mode;
13 int mode_setup;
14};
15
16int l3_write(struct l3_pins *adap, u8 addr, u8 *data, int len);
17
18#endif
diff --git a/include/sound/s3c24xx_uda134x.h b/include/sound/s3c24xx_uda134x.h
new file mode 100644
index 00000000000..33df4cb909d
--- /dev/null
+++ b/include/sound/s3c24xx_uda134x.h
@@ -0,0 +1,14 @@
1#ifndef _S3C24XX_UDA134X_H_
2#define _S3C24XX_UDA134X_H_ 1
3
4#include <sound/uda134x.h>
5
6struct s3c24xx_uda134x_platform_data {
7 int l3_clk;
8 int l3_mode;
9 int l3_data;
10 void (*power) (int);
11 int model;
12};
13
14#endif
diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
new file mode 100644
index 00000000000..24247f76360
--- /dev/null
+++ b/include/sound/soc-dai.h
@@ -0,0 +1,231 @@
1/*
2 * linux/sound/soc-dai.h -- ALSA SoC Layer
3 *
4 * Copyright: 2005-2008 Wolfson Microelectronics. PLC.
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 * Digital Audio Interface (DAI) API.
11 */
12
13#ifndef __LINUX_SND_SOC_DAI_H
14#define __LINUX_SND_SOC_DAI_H
15
16
17#include <linux/list.h>
18
19struct snd_pcm_substream;
20
21/*
22 * DAI hardware audio formats.
23 *
24 * Describes the physical PCM data formating and clocking. Add new formats
25 * to the end.
26 */
27#define SND_SOC_DAIFMT_I2S 0 /* I2S mode */
28#define SND_SOC_DAIFMT_RIGHT_J 1 /* Right Justified mode */
29#define SND_SOC_DAIFMT_LEFT_J 2 /* Left Justified mode */
30#define SND_SOC_DAIFMT_DSP_A 3 /* L data msb after FRM LRC */
31#define SND_SOC_DAIFMT_DSP_B 4 /* L data msb during FRM LRC */
32#define SND_SOC_DAIFMT_AC97 5 /* AC97 */
33
34/* left and right justified also known as MSB and LSB respectively */
35#define SND_SOC_DAIFMT_MSB SND_SOC_DAIFMT_LEFT_J
36#define SND_SOC_DAIFMT_LSB SND_SOC_DAIFMT_RIGHT_J
37
38/*
39 * DAI Clock gating.
40 *
41 * DAI bit clocks can be be gated (disabled) when not the DAI is not
42 * sending or receiving PCM data in a frame. This can be used to save power.
43 */
44#define SND_SOC_DAIFMT_CONT (0 << 4) /* continuous clock */
45#define SND_SOC_DAIFMT_GATED (1 << 4) /* clock is gated */
46
47/*
48 * DAI Left/Right Clocks.
49 *
50 * Specifies whether the DAI can support different samples for similtanious
51 * playback and capture. This usually requires a seperate physical frame
52 * clock for playback and capture.
53 */
54#define SND_SOC_DAIFMT_SYNC (0 << 5) /* Tx FRM = Rx FRM */
55#define SND_SOC_DAIFMT_ASYNC (1 << 5) /* Tx FRM ~ Rx FRM */
56
57/*
58 * TDM
59 *
60 * Time Division Multiplexing. Allows PCM data to be multplexed with other
61 * data on the DAI.
62 */
63#define SND_SOC_DAIFMT_TDM (1 << 6)
64
65/*
66 * DAI hardware signal inversions.
67 *
68 * Specifies whether the DAI can also support inverted clocks for the specified
69 * format.
70 */
71#define SND_SOC_DAIFMT_NB_NF (0 << 8) /* normal bit clock + frame */
72#define SND_SOC_DAIFMT_NB_IF (1 << 8) /* normal bclk + inv frm */
73#define SND_SOC_DAIFMT_IB_NF (2 << 8) /* invert bclk + nor frm */
74#define SND_SOC_DAIFMT_IB_IF (3 << 8) /* invert bclk + frm */
75
76/*
77 * DAI hardware clock masters.
78 *
79 * This is wrt the codec, the inverse is true for the interface
80 * i.e. if the codec is clk and frm master then the interface is
81 * clk and frame slave.
82 */
83#define SND_SOC_DAIFMT_CBM_CFM (0 << 12) /* codec clk & frm master */
84#define SND_SOC_DAIFMT_CBS_CFM (1 << 12) /* codec clk slave & frm master */
85#define SND_SOC_DAIFMT_CBM_CFS (2 << 12) /* codec clk master & frame slave */
86#define SND_SOC_DAIFMT_CBS_CFS (3 << 12) /* codec clk & frm slave */
87
88#define SND_SOC_DAIFMT_FORMAT_MASK 0x000f
89#define SND_SOC_DAIFMT_CLOCK_MASK 0x00f0
90#define SND_SOC_DAIFMT_INV_MASK 0x0f00
91#define SND_SOC_DAIFMT_MASTER_MASK 0xf000
92
93/*
94 * Master Clock Directions
95 */
96#define SND_SOC_CLOCK_IN 0
97#define SND_SOC_CLOCK_OUT 1
98
99struct snd_soc_dai_ops;
100struct snd_soc_dai;
101struct snd_ac97_bus_ops;
102
103/* Digital Audio Interface registration */
104int snd_soc_register_dai(struct snd_soc_dai *dai);
105void snd_soc_unregister_dai(struct snd_soc_dai *dai);
106int snd_soc_register_dais(struct snd_soc_dai *dai, size_t count);
107void snd_soc_unregister_dais(struct snd_soc_dai *dai, size_t count);
108
109/* Digital Audio Interface clocking API.*/
110int snd_soc_dai_set_sysclk(struct snd_soc_dai *dai, int clk_id,
111 unsigned int freq, int dir);
112
113int snd_soc_dai_set_clkdiv(struct snd_soc_dai *dai,
114 int div_id, int div);
115
116int snd_soc_dai_set_pll(struct snd_soc_dai *dai,
117 int pll_id, unsigned int freq_in, unsigned int freq_out);
118
119/* Digital Audio interface formatting */
120int snd_soc_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt);
121
122int snd_soc_dai_set_tdm_slot(struct snd_soc_dai *dai,
123 unsigned int mask, int slots);
124
125int snd_soc_dai_set_tristate(struct snd_soc_dai *dai, int tristate);
126
127/* Digital Audio Interface mute */
128int snd_soc_dai_digital_mute(struct snd_soc_dai *dai, int mute);
129
130/*
131 * Digital Audio Interface.
132 *
133 * Describes the Digital Audio Interface in terms of it's ALSA, DAI and AC97
134 * operations an capabilities. Codec and platfom drivers will register a this
135 * structure for every DAI they have.
136 *
137 * This structure covers the clocking, formating and ALSA operations for each
138 * interface a
139 */
140struct snd_soc_dai_ops {
141 /*
142 * DAI clocking configuration, all optional.
143 * Called by soc_card drivers, normally in their hw_params.
144 */
145 int (*set_sysclk)(struct snd_soc_dai *dai,
146 int clk_id, unsigned int freq, int dir);
147 int (*set_pll)(struct snd_soc_dai *dai,
148 int pll_id, unsigned int freq_in, unsigned int freq_out);
149 int (*set_clkdiv)(struct snd_soc_dai *dai, int div_id, int div);
150
151 /*
152 * DAI format configuration
153 * Called by soc_card drivers, normally in their hw_params.
154 */
155 int (*set_fmt)(struct snd_soc_dai *dai, unsigned int fmt);
156 int (*set_tdm_slot)(struct snd_soc_dai *dai,
157 unsigned int mask, int slots);
158 int (*set_tristate)(struct snd_soc_dai *dai, int tristate);
159
160 /*
161 * DAI digital mute - optional.
162 * Called by soc-core to minimise any pops.
163 */
164 int (*digital_mute)(struct snd_soc_dai *dai, int mute);
165
166 /*
167 * ALSA PCM audio operations - all optional.
168 * Called by soc-core during audio PCM operations.
169 */
170 int (*startup)(struct snd_pcm_substream *,
171 struct snd_soc_dai *);
172 void (*shutdown)(struct snd_pcm_substream *,
173 struct snd_soc_dai *);
174 int (*hw_params)(struct snd_pcm_substream *,
175 struct snd_pcm_hw_params *, struct snd_soc_dai *);
176 int (*hw_free)(struct snd_pcm_substream *,
177 struct snd_soc_dai *);
178 int (*prepare)(struct snd_pcm_substream *,
179 struct snd_soc_dai *);
180 int (*trigger)(struct snd_pcm_substream *, int,
181 struct snd_soc_dai *);
182};
183
184/*
185 * Digital Audio Interface runtime data.
186 *
187 * Holds runtime data for a DAI.
188 */
189struct snd_soc_dai {
190 /* DAI description */
191 char *name;
192 unsigned int id;
193 int ac97_control;
194
195 struct device *dev;
196
197 /* DAI callbacks */
198 int (*probe)(struct platform_device *pdev,
199 struct snd_soc_dai *dai);
200 void (*remove)(struct platform_device *pdev,
201 struct snd_soc_dai *dai);
202 int (*suspend)(struct snd_soc_dai *dai);
203 int (*resume)(struct snd_soc_dai *dai);
204
205 /* ops */
206 struct snd_soc_dai_ops ops;
207
208 /* DAI capabilities */
209 struct snd_soc_pcm_stream capture;
210 struct snd_soc_pcm_stream playback;
211
212 /* DAI runtime info */
213 struct snd_pcm_runtime *runtime;
214 struct snd_soc_codec *codec;
215 unsigned int active;
216 unsigned char pop_wait:1;
217 void *dma_data;
218
219 /* DAI private data */
220 void *private_data;
221
222 /* parent codec/platform */
223 union {
224 struct snd_soc_codec *codec;
225 struct snd_soc_platform *platform;
226 };
227
228 struct list_head list;
229};
230
231#endif
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index ca699a3017f..7ee2f70ca42 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -221,8 +221,6 @@ int snd_soc_dapm_new_controls(struct snd_soc_codec *codec,
221 int num); 221 int num);
222 222
223/* dapm path setup */ 223/* dapm path setup */
224int __deprecated snd_soc_dapm_connect_input(struct snd_soc_codec *codec,
225 const char *sink_name, const char *control_name, const char *src_name);
226int snd_soc_dapm_new_widgets(struct snd_soc_codec *codec); 224int snd_soc_dapm_new_widgets(struct snd_soc_codec *codec);
227void snd_soc_dapm_free(struct snd_soc_device *socdev); 225void snd_soc_dapm_free(struct snd_soc_device *socdev);
228int snd_soc_dapm_add_routes(struct snd_soc_codec *codec, 226int snd_soc_dapm_add_routes(struct snd_soc_codec *codec,
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 5e0189876af..f86e455d382 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -21,8 +21,6 @@
21#include <sound/control.h> 21#include <sound/control.h>
22#include <sound/ac97_codec.h> 22#include <sound/ac97_codec.h>
23 23
24#define SND_SOC_VERSION "0.13.2"
25
26/* 24/*
27 * Convenience kcontrol builders 25 * Convenience kcontrol builders
28 */ 26 */
@@ -145,105 +143,31 @@ enum snd_soc_bias_level {
145 SND_SOC_BIAS_OFF, 143 SND_SOC_BIAS_OFF,
146}; 144};
147 145
148/*
149 * Digital Audio Interface (DAI) types
150 */
151#define SND_SOC_DAI_AC97 0x1
152#define SND_SOC_DAI_I2S 0x2
153#define SND_SOC_DAI_PCM 0x4
154#define SND_SOC_DAI_AC97_BUS 0x8 /* for custom i.e. non ac97_codec.c */
155
156/*
157 * DAI hardware audio formats
158 */
159#define SND_SOC_DAIFMT_I2S 0 /* I2S mode */
160#define SND_SOC_DAIFMT_RIGHT_J 1 /* Right justified mode */
161#define SND_SOC_DAIFMT_LEFT_J 2 /* Left Justified mode */
162#define SND_SOC_DAIFMT_DSP_A 3 /* L data msb after FRM or LRC */
163#define SND_SOC_DAIFMT_DSP_B 4 /* L data msb during FRM or LRC */
164#define SND_SOC_DAIFMT_AC97 5 /* AC97 */
165
166#define SND_SOC_DAIFMT_MSB SND_SOC_DAIFMT_LEFT_J
167#define SND_SOC_DAIFMT_LSB SND_SOC_DAIFMT_RIGHT_J
168
169/*
170 * DAI Gating
171 */
172#define SND_SOC_DAIFMT_CONT (0 << 4) /* continuous clock */
173#define SND_SOC_DAIFMT_GATED (1 << 4) /* clock is gated when not Tx/Rx */
174
175/*
176 * DAI Sync
177 * Synchronous LR (Left Right) clocks and Frame signals.
178 */
179#define SND_SOC_DAIFMT_SYNC (0 << 5) /* Tx FRM = Rx FRM */
180#define SND_SOC_DAIFMT_ASYNC (1 << 5) /* Tx FRM ~ Rx FRM */
181
182/*
183 * TDM
184 */
185#define SND_SOC_DAIFMT_TDM (1 << 6)
186
187/*
188 * DAI hardware signal inversions
189 */
190#define SND_SOC_DAIFMT_NB_NF (0 << 8) /* normal bclk + frm */
191#define SND_SOC_DAIFMT_NB_IF (1 << 8) /* normal bclk + inv frm */
192#define SND_SOC_DAIFMT_IB_NF (2 << 8) /* invert bclk + nor frm */
193#define SND_SOC_DAIFMT_IB_IF (3 << 8) /* invert bclk + frm */
194
195/*
196 * DAI hardware clock masters
197 * This is wrt the codec, the inverse is true for the interface
198 * i.e. if the codec is clk and frm master then the interface is
199 * clk and frame slave.
200 */
201#define SND_SOC_DAIFMT_CBM_CFM (0 << 12) /* codec clk & frm master */
202#define SND_SOC_DAIFMT_CBS_CFM (1 << 12) /* codec clk slave & frm master */
203#define SND_SOC_DAIFMT_CBM_CFS (2 << 12) /* codec clk master & frame slave */
204#define SND_SOC_DAIFMT_CBS_CFS (3 << 12) /* codec clk & frm slave */
205
206#define SND_SOC_DAIFMT_FORMAT_MASK 0x000f
207#define SND_SOC_DAIFMT_CLOCK_MASK 0x00f0
208#define SND_SOC_DAIFMT_INV_MASK 0x0f00
209#define SND_SOC_DAIFMT_MASTER_MASK 0xf000
210
211
212/*
213 * Master Clock Directions
214 */
215#define SND_SOC_CLOCK_IN 0
216#define SND_SOC_CLOCK_OUT 1
217
218/*
219 * AC97 codec ID's bitmask
220 */
221#define SND_SOC_DAI_AC97_ID0 (1 << 0)
222#define SND_SOC_DAI_AC97_ID1 (1 << 1)
223#define SND_SOC_DAI_AC97_ID2 (1 << 2)
224#define SND_SOC_DAI_AC97_ID3 (1 << 3)
225
226struct snd_soc_device; 146struct snd_soc_device;
227struct snd_soc_pcm_stream; 147struct snd_soc_pcm_stream;
228struct snd_soc_ops; 148struct snd_soc_ops;
229struct snd_soc_dai_mode; 149struct snd_soc_dai_mode;
230struct snd_soc_pcm_runtime; 150struct snd_soc_pcm_runtime;
231struct snd_soc_dai; 151struct snd_soc_dai;
152struct snd_soc_platform;
232struct snd_soc_codec; 153struct snd_soc_codec;
233struct snd_soc_machine_config;
234struct soc_enum; 154struct soc_enum;
235struct snd_soc_ac97_ops; 155struct snd_soc_ac97_ops;
236struct snd_soc_clock_info;
237 156
238typedef int (*hw_write_t)(void *,const char* ,int); 157typedef int (*hw_write_t)(void *,const char* ,int);
239typedef int (*hw_read_t)(void *,char* ,int); 158typedef int (*hw_read_t)(void *,char* ,int);
240 159
241extern struct snd_ac97_bus_ops soc_ac97_ops; 160extern struct snd_ac97_bus_ops soc_ac97_ops;
242 161
162int snd_soc_register_platform(struct snd_soc_platform *platform);
163void snd_soc_unregister_platform(struct snd_soc_platform *platform);
164int snd_soc_register_codec(struct snd_soc_codec *codec);
165void snd_soc_unregister_codec(struct snd_soc_codec *codec);
166
243/* pcm <-> DAI connect */ 167/* pcm <-> DAI connect */
244void snd_soc_free_pcms(struct snd_soc_device *socdev); 168void snd_soc_free_pcms(struct snd_soc_device *socdev);
245int snd_soc_new_pcms(struct snd_soc_device *socdev, int idx, const char *xid); 169int snd_soc_new_pcms(struct snd_soc_device *socdev, int idx, const char *xid);
246int snd_soc_register_card(struct snd_soc_device *socdev); 170int snd_soc_init_card(struct snd_soc_device *socdev);
247 171
248/* set runtime hw params */ 172/* set runtime hw params */
249int snd_soc_set_runtime_hwparams(struct snd_pcm_substream *substream, 173int snd_soc_set_runtime_hwparams(struct snd_pcm_substream *substream,
@@ -263,27 +187,6 @@ int snd_soc_new_ac97_codec(struct snd_soc_codec *codec,
263 struct snd_ac97_bus_ops *ops, int num); 187 struct snd_ac97_bus_ops *ops, int num);
264void snd_soc_free_ac97_codec(struct snd_soc_codec *codec); 188void snd_soc_free_ac97_codec(struct snd_soc_codec *codec);
265 189
266/* Digital Audio Interface clocking API.*/
267int snd_soc_dai_set_sysclk(struct snd_soc_dai *dai, int clk_id,
268 unsigned int freq, int dir);
269
270int snd_soc_dai_set_clkdiv(struct snd_soc_dai *dai,
271 int div_id, int div);
272
273int snd_soc_dai_set_pll(struct snd_soc_dai *dai,
274 int pll_id, unsigned int freq_in, unsigned int freq_out);
275
276/* Digital Audio interface formatting */
277int snd_soc_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt);
278
279int snd_soc_dai_set_tdm_slot(struct snd_soc_dai *dai,
280 unsigned int mask, int slots);
281
282int snd_soc_dai_set_tristate(struct snd_soc_dai *dai, int tristate);
283
284/* Digital Audio Interface mute */
285int snd_soc_dai_digital_mute(struct snd_soc_dai *dai, int mute);
286
287/* 190/*
288 *Controls 191 *Controls
289 */ 192 */
@@ -341,66 +244,14 @@ struct snd_soc_ops {
341 int (*trigger)(struct snd_pcm_substream *, int); 244 int (*trigger)(struct snd_pcm_substream *, int);
342}; 245};
343 246
344/* ASoC DAI ops */
345struct snd_soc_dai_ops {
346 /* DAI clocking configuration */
347 int (*set_sysclk)(struct snd_soc_dai *dai,
348 int clk_id, unsigned int freq, int dir);
349 int (*set_pll)(struct snd_soc_dai *dai,
350 int pll_id, unsigned int freq_in, unsigned int freq_out);
351 int (*set_clkdiv)(struct snd_soc_dai *dai, int div_id, int div);
352
353 /* DAI format configuration */
354 int (*set_fmt)(struct snd_soc_dai *dai, unsigned int fmt);
355 int (*set_tdm_slot)(struct snd_soc_dai *dai,
356 unsigned int mask, int slots);
357 int (*set_tristate)(struct snd_soc_dai *dai, int tristate);
358
359 /* digital mute */
360 int (*digital_mute)(struct snd_soc_dai *dai, int mute);
361};
362
363/* SoC DAI (Digital Audio Interface) */
364struct snd_soc_dai {
365 /* DAI description */
366 char *name;
367 unsigned int id;
368 unsigned char type;
369
370 /* DAI callbacks */
371 int (*probe)(struct platform_device *pdev,
372 struct snd_soc_dai *dai);
373 void (*remove)(struct platform_device *pdev,
374 struct snd_soc_dai *dai);
375 int (*suspend)(struct platform_device *pdev,
376 struct snd_soc_dai *dai);
377 int (*resume)(struct platform_device *pdev,
378 struct snd_soc_dai *dai);
379
380 /* ops */
381 struct snd_soc_ops ops;
382 struct snd_soc_dai_ops dai_ops;
383
384 /* DAI capabilities */
385 struct snd_soc_pcm_stream capture;
386 struct snd_soc_pcm_stream playback;
387
388 /* DAI runtime info */
389 struct snd_pcm_runtime *runtime;
390 struct snd_soc_codec *codec;
391 unsigned int active;
392 unsigned char pop_wait:1;
393 void *dma_data;
394
395 /* DAI private data */
396 void *private_data;
397};
398
399/* SoC Audio Codec */ 247/* SoC Audio Codec */
400struct snd_soc_codec { 248struct snd_soc_codec {
401 char *name; 249 char *name;
402 struct module *owner; 250 struct module *owner;
403 struct mutex mutex; 251 struct mutex mutex;
252 struct device *dev;
253
254 struct list_head list;
404 255
405 /* callbacks */ 256 /* callbacks */
406 int (*set_bias_level)(struct snd_soc_codec *, 257 int (*set_bias_level)(struct snd_soc_codec *,
@@ -426,6 +277,7 @@ struct snd_soc_codec {
426 short reg_cache_step; 277 short reg_cache_step;
427 278
428 /* dapm */ 279 /* dapm */
280 u32 pop_time;
429 struct list_head dapm_widgets; 281 struct list_head dapm_widgets;
430 struct list_head dapm_paths; 282 struct list_head dapm_paths;
431 enum snd_soc_bias_level bias_level; 283 enum snd_soc_bias_level bias_level;
@@ -435,6 +287,11 @@ struct snd_soc_codec {
435 /* codec DAI's */ 287 /* codec DAI's */
436 struct snd_soc_dai *dai; 288 struct snd_soc_dai *dai;
437 unsigned int num_dai; 289 unsigned int num_dai;
290
291#ifdef CONFIG_DEBUG_FS
292 struct dentry *debugfs_reg;
293 struct dentry *debugfs_pop_time;
294#endif
438}; 295};
439 296
440/* codec device */ 297/* codec device */
@@ -448,13 +305,12 @@ struct snd_soc_codec_device {
448/* SoC platform interface */ 305/* SoC platform interface */
449struct snd_soc_platform { 306struct snd_soc_platform {
450 char *name; 307 char *name;
308 struct list_head list;
451 309
452 int (*probe)(struct platform_device *pdev); 310 int (*probe)(struct platform_device *pdev);
453 int (*remove)(struct platform_device *pdev); 311 int (*remove)(struct platform_device *pdev);
454 int (*suspend)(struct platform_device *pdev, 312 int (*suspend)(struct snd_soc_dai *dai);
455 struct snd_soc_dai *dai); 313 int (*resume)(struct snd_soc_dai *dai);
456 int (*resume)(struct platform_device *pdev,
457 struct snd_soc_dai *dai);
458 314
459 /* pcm creation and destruction */ 315 /* pcm creation and destruction */
460 int (*pcm_new)(struct snd_card *, struct snd_soc_dai *, 316 int (*pcm_new)(struct snd_card *, struct snd_soc_dai *,
@@ -484,9 +340,14 @@ struct snd_soc_dai_link {
484 struct snd_pcm *pcm; 340 struct snd_pcm *pcm;
485}; 341};
486 342
487/* SoC machine */ 343/* SoC card */
488struct snd_soc_machine { 344struct snd_soc_card {
489 char *name; 345 char *name;
346 struct device *dev;
347
348 struct list_head list;
349
350 int instantiated;
490 351
491 int (*probe)(struct platform_device *pdev); 352 int (*probe)(struct platform_device *pdev);
492 int (*remove)(struct platform_device *pdev); 353 int (*remove)(struct platform_device *pdev);
@@ -499,23 +360,26 @@ struct snd_soc_machine {
499 int (*resume_post)(struct platform_device *pdev); 360 int (*resume_post)(struct platform_device *pdev);
500 361
501 /* callbacks */ 362 /* callbacks */
502 int (*set_bias_level)(struct snd_soc_machine *, 363 int (*set_bias_level)(struct snd_soc_card *,
503 enum snd_soc_bias_level level); 364 enum snd_soc_bias_level level);
504 365
505 /* CPU <--> Codec DAI links */ 366 /* CPU <--> Codec DAI links */
506 struct snd_soc_dai_link *dai_link; 367 struct snd_soc_dai_link *dai_link;
507 int num_links; 368 int num_links;
369
370 struct snd_soc_device *socdev;
371
372 struct snd_soc_platform *platform;
373 struct delayed_work delayed_work;
374 struct work_struct deferred_resume_work;
508}; 375};
509 376
510/* SoC Device - the audio subsystem */ 377/* SoC Device - the audio subsystem */
511struct snd_soc_device { 378struct snd_soc_device {
512 struct device *dev; 379 struct device *dev;
513 struct snd_soc_machine *machine; 380 struct snd_soc_card *card;
514 struct snd_soc_platform *platform;
515 struct snd_soc_codec *codec; 381 struct snd_soc_codec *codec;
516 struct snd_soc_codec_device *codec_dev; 382 struct snd_soc_codec_device *codec_dev;
517 struct delayed_work delayed_work;
518 struct work_struct deferred_resume_work;
519 void *codec_data; 383 void *codec_data;
520}; 384};
521 385
@@ -542,4 +406,6 @@ struct soc_enum {
542 void *dapm; 406 void *dapm;
543}; 407};
544 408
409#include <sound/soc-dai.h>
410
545#endif 411#endif
diff --git a/include/sound/uda134x.h b/include/sound/uda134x.h
new file mode 100644
index 00000000000..475ef8bb7dc
--- /dev/null
+++ b/include/sound/uda134x.h
@@ -0,0 +1,26 @@
1/*
2 * uda134x.h -- UDA134x ALSA SoC Codec driver
3 *
4 * Copyright 2007 Dension Audio Systems Ltd.
5 * Author: Zoltan Devai
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 _UDA134X_H
13#define _UDA134X_H
14
15#include <sound/l3.h>
16
17struct uda134x_platform_data {
18 struct l3_pins l3;
19 void (*power) (int);
20 int model;
21#define UDA134X_UDA1340 1
22#define UDA134X_UDA1341 2
23#define UDA134X_UDA1344 3
24};
25
26#endif /* _UDA134X_H */
diff --git a/include/sound/version.h b/include/sound/version.h
index 4aafeda8863..2b48237e23b 100644
--- a/include/sound/version.h
+++ b/include/sound/version.h
@@ -1,3 +1,3 @@
1/* include/version.h */ 1/* include/version.h */
2#define CONFIG_SND_VERSION "1.0.18rc3" 2#define CONFIG_SND_VERSION "1.0.18a"
3#define CONFIG_SND_DATE "" 3#define CONFIG_SND_DATE ""
diff --git a/include/trace/sched.h b/include/trace/sched.h
index 9b2854abf7e..0d81098ee9f 100644
--- a/include/trace/sched.h
+++ b/include/trace/sched.h
@@ -17,12 +17,12 @@ DECLARE_TRACE(sched_wait_task,
17 TPARGS(rq, p)); 17 TPARGS(rq, p));
18 18
19DECLARE_TRACE(sched_wakeup, 19DECLARE_TRACE(sched_wakeup,
20 TPPROTO(struct rq *rq, struct task_struct *p), 20 TPPROTO(struct rq *rq, struct task_struct *p, int success),
21 TPARGS(rq, p)); 21 TPARGS(rq, p, success));
22 22
23DECLARE_TRACE(sched_wakeup_new, 23DECLARE_TRACE(sched_wakeup_new,
24 TPPROTO(struct rq *rq, struct task_struct *p), 24 TPPROTO(struct rq *rq, struct task_struct *p, int success),
25 TPARGS(rq, p)); 25 TPARGS(rq, p, success));
26 26
27DECLARE_TRACE(sched_switch, 27DECLARE_TRACE(sched_switch,
28 TPPROTO(struct rq *rq, struct task_struct *prev, 28 TPPROTO(struct rq *rq, struct task_struct *prev,
@@ -30,8 +30,8 @@ DECLARE_TRACE(sched_switch,
30 TPARGS(rq, prev, next)); 30 TPARGS(rq, prev, next));
31 31
32DECLARE_TRACE(sched_migrate_task, 32DECLARE_TRACE(sched_migrate_task,
33 TPPROTO(struct rq *rq, struct task_struct *p, int dest_cpu), 33 TPPROTO(struct task_struct *p, int orig_cpu, int dest_cpu),
34 TPARGS(rq, p, dest_cpu)); 34 TPARGS(p, orig_cpu, dest_cpu));
35 35
36DECLARE_TRACE(sched_process_free, 36DECLARE_TRACE(sched_process_free,
37 TPPROTO(struct task_struct *p), 37 TPPROTO(struct task_struct *p),
diff --git a/include/video/sh_mobile_lcdc.h b/include/video/sh_mobile_lcdc.h
index 1a4bc6ada60..25144ab22b9 100644
--- a/include/video/sh_mobile_lcdc.h
+++ b/include/video/sh_mobile_lcdc.h
@@ -37,6 +37,7 @@ enum { LCDC_CLK_BUS, LCDC_CLK_PERIPHERAL, LCDC_CLK_EXTERNAL };
37struct sh_mobile_lcdc_sys_bus_cfg { 37struct sh_mobile_lcdc_sys_bus_cfg {
38 unsigned long ldmt2r; 38 unsigned long ldmt2r;
39 unsigned long ldmt3r; 39 unsigned long ldmt3r;
40 unsigned long deferred_io_msec;
40}; 41};
41 42
42struct sh_mobile_lcdc_sys_bus_ops { 43struct sh_mobile_lcdc_sys_bus_ops {
diff --git a/include/xen/interface/event_channel.h b/include/xen/interface/event_channel.h
index 919b5bdcb2b..2090881c365 100644
--- a/include/xen/interface/event_channel.h
+++ b/include/xen/interface/event_channel.h
@@ -9,6 +9,8 @@
9#ifndef __XEN_PUBLIC_EVENT_CHANNEL_H__ 9#ifndef __XEN_PUBLIC_EVENT_CHANNEL_H__
10#define __XEN_PUBLIC_EVENT_CHANNEL_H__ 10#define __XEN_PUBLIC_EVENT_CHANNEL_H__
11 11
12#include <xen/interface/xen.h>
13
12typedef uint32_t evtchn_port_t; 14typedef uint32_t evtchn_port_t;
13DEFINE_GUEST_HANDLE(evtchn_port_t); 15DEFINE_GUEST_HANDLE(evtchn_port_t);
14 16