aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-01-31 08:27:28 -0500
committerIngo Molnar <mingo@elte.hu>2009-01-31 08:27:28 -0500
commit9f84653bbfba4f6c1bc7c0de914319bad55f17a4 (patch)
tree0455f3e221d6128ba1efb68135c3fbe2c2c8b390
parent3ac6cffea4aa18007a454a7442da2855882f403d (diff)
parentda2c0b021cde94866f1e492f940aad29e8f61258 (diff)
Merge branch 'tj-percpu' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/misc into core/percpu
-rw-r--r--Documentation/block/biodoc.txt6
-rw-r--r--Documentation/networking/alias.txt25
-rw-r--r--MAINTAINERS2
-rw-r--r--arch/x86/include/asm/processor.h3
-rw-r--r--arch/x86/kernel/cpu/common.c25
-rw-r--r--arch/x86/kernel/setup_percpu.c2
-rw-r--r--arch/x86/kernel/smpboot.c2
-rw-r--r--arch/x86/kernel/tlb_uv.c2
-rw-r--r--arch/x86/mach-voyager/voyager_smp.c11
-rw-r--r--arch/x86/xen/enlighten.c3
-rw-r--r--arch/x86/xen/smp.c5
-rw-r--r--block/blk-barrier.c2
-rw-r--r--block/blk-core.c100
-rw-r--r--block/blk-integrity.c25
-rw-r--r--block/blk-sysfs.c58
-rw-r--r--block/blktrace.c72
-rw-r--r--block/cfq-iosched.c39
-rw-r--r--drivers/net/e1000/e1000_main.c4
-rw-r--r--drivers/net/gianfar_mii.c2
-rw-r--r--drivers/net/netxen/netxen_nic.h2
-rw-r--r--drivers/net/netxen/netxen_nic_init.c4
-rw-r--r--drivers/net/r6040.c1
-rw-r--r--drivers/net/skfp/skfddi.c4
-rw-r--r--drivers/net/smsc911x.c2
-rw-r--r--drivers/net/smsc9420.c3
-rw-r--r--drivers/net/tulip/21142.c23
-rw-r--r--drivers/net/ucc_geth.c20
-rw-r--r--drivers/net/ucc_geth.h2
-rw-r--r--drivers/net/ucc_geth_mii.c12
-rw-r--r--drivers/net/ucc_geth_mii.h1
-rw-r--r--drivers/net/virtio_net.c6
-rw-r--r--drivers/net/wimax/i2400m/debugfs.c14
-rw-r--r--drivers/net/wimax/i2400m/driver.c16
-rw-r--r--drivers/net/wireless/ath5k/base.c10
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c4
-rw-r--r--drivers/net/wireless/rtl818x/rtl8187_rtl8225.c10
-rw-r--r--drivers/serial/jsm/jsm_tty.c6
-rw-r--r--fs/bio-integrity.c26
-rw-r--r--fs/compat_ioctl.c7
-rw-r--r--fs/ext3/namei.c20
-rw-r--r--fs/ext4/balloc.c6
-rw-r--r--fs/ext4/ext4.h7
-rw-r--r--fs/ext4/extents.c2
-rw-r--r--fs/ext4/inode.c9
-rw-r--r--fs/ext4/mballoc.c2
-rw-r--r--fs/ext4/namei.c21
-rw-r--r--fs/ext4/resize.c3
-rw-r--r--fs/jbd2/journal.c6
-rw-r--r--include/linux/Kbuild1
-rw-r--r--include/linux/bio.h45
-rw-r--r--include/linux/blkdev.h8
-rw-r--r--include/linux/jbd2.h3
-rw-r--r--include/net/inet_hashtables.h2
-rw-r--r--mm/mmap.c5
-rw-r--r--net/core/skbuff.c15
-rw-r--r--net/ipv4/ipconfig.c6
-rw-r--r--net/ipv4/tcp.c3
-rw-r--r--net/ipv4/udp.c55
-rw-r--r--net/ipv6/addrconf.c2
-rw-r--r--net/ipv6/icmp.c4
-rw-r--r--net/ipv6/ip6_input.c2
-rw-r--r--net/ipv6/ip6mr.c23
-rw-r--r--net/ipv6/route.c2
-rw-r--r--net/wimax/debugfs.c11
-rw-r--r--net/wimax/stack.c13
-rw-r--r--net/wireless/reg.c32
66 files changed, 566 insertions, 303 deletions
diff --git a/Documentation/block/biodoc.txt b/Documentation/block/biodoc.txt
index 5d2480d33b4..ecad6ee7570 100644
--- a/Documentation/block/biodoc.txt
+++ b/Documentation/block/biodoc.txt
@@ -954,14 +954,14 @@ elevator_allow_merge_fn called whenever the block layer determines
954 results in some sort of conflict internally, 954 results in some sort of conflict internally,
955 this hook allows it to do that. 955 this hook allows it to do that.
956 956
957elevator_dispatch_fn fills the dispatch queue with ready requests. 957elevator_dispatch_fn* fills the dispatch queue with ready requests.
958 I/O schedulers are free to postpone requests by 958 I/O schedulers are free to postpone requests by
959 not filling the dispatch queue unless @force 959 not filling the dispatch queue unless @force
960 is non-zero. Once dispatched, I/O schedulers 960 is non-zero. Once dispatched, I/O schedulers
961 are not allowed to manipulate the requests - 961 are not allowed to manipulate the requests -
962 they belong to generic dispatch queue. 962 they belong to generic dispatch queue.
963 963
964elevator_add_req_fn called to add a new request into the scheduler 964elevator_add_req_fn* called to add a new request into the scheduler
965 965
966elevator_queue_empty_fn returns true if the merge queue is empty. 966elevator_queue_empty_fn returns true if the merge queue is empty.
967 Drivers shouldn't use this, but rather check 967 Drivers shouldn't use this, but rather check
@@ -991,7 +991,7 @@ elevator_activate_req_fn Called when device driver first sees a request.
991elevator_deactivate_req_fn Called when device driver decides to delay 991elevator_deactivate_req_fn Called when device driver decides to delay
992 a request by requeueing it. 992 a request by requeueing it.
993 993
994elevator_init_fn 994elevator_init_fn*
995elevator_exit_fn Allocate and free any elevator specific storage 995elevator_exit_fn Allocate and free any elevator specific storage
996 for a queue. 996 for a queue.
997 997
diff --git a/Documentation/networking/alias.txt b/Documentation/networking/alias.txt
index cd12c2ff518..85046f53fcf 100644
--- a/Documentation/networking/alias.txt
+++ b/Documentation/networking/alias.txt
@@ -2,13 +2,13 @@
2IP-Aliasing: 2IP-Aliasing:
3============ 3============
4 4
5IP-aliases are additional IP-addresses/masks hooked up to a base 5IP-aliases are an obsolete way to manage multiple IP-addresses/masks
6interface by adding a colon and a string when running ifconfig. 6per interface. Newer tools such as iproute2 support multiple
7This string is usually numeric, but this is not a must. 7address/prefixes per interface, but aliases are still supported
8 8for backwards compatibility.
9IP-Aliases are avail if CONFIG_INET (`standard' IPv4 networking)
10is configured in the kernel.
11 9
10An alias is formed by adding a colon and a string when running ifconfig.
11This string is usually numeric, but this is not a must.
12 12
13o Alias creation. 13o Alias creation.
14 Alias creation is done by 'magic' interface naming: eg. to create a 14 Alias creation is done by 'magic' interface naming: eg. to create a
@@ -38,16 +38,3 @@ o Relationship with main device
38 38
39 If the base device is shut down the added aliases will be deleted 39 If the base device is shut down the added aliases will be deleted
40 too. 40 too.
41
42
43Contact
44-------
45Please finger or e-mail me:
46 Juan Jose Ciarlante <jjciarla@raiz.uncu.edu.ar>
47
48Updated by Erik Schoenfelder <schoenfr@gaertner.DE>
49
50; local variables:
51; mode: indented-text
52; mode: auto-fill
53; end:
diff --git a/MAINTAINERS b/MAINTAINERS
index d992d407197..474ec0c5327 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2836,8 +2836,6 @@ S: Maintained
2836MAC80211 2836MAC80211
2837P: Johannes Berg 2837P: Johannes Berg
2838M: johannes@sipsolutions.net 2838M: johannes@sipsolutions.net
2839P: Michael Wu
2840M: flamingice@sourmilk.net
2841L: linux-wireless@vger.kernel.org 2839L: linux-wireless@vger.kernel.org
2842W: http://linuxwireless.org/ 2840W: http://linuxwireless.org/
2843T: git kernel.org:/pub/scm/linux/kernel/git/linville/wireless-2.6.git 2841T: git kernel.org:/pub/scm/linux/kernel/git/linville/wireless-2.6.git
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index befa20b4a68..656d02ea509 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -768,7 +768,8 @@ extern int sysenter_setup(void);
768extern struct desc_ptr early_gdt_descr; 768extern struct desc_ptr early_gdt_descr;
769 769
770extern void cpu_set_gdt(int); 770extern void cpu_set_gdt(int);
771extern void switch_to_new_gdt(void); 771extern void switch_to_new_gdt(int);
772extern void load_percpu_segment(int);
772extern void cpu_init(void); 773extern void cpu_init(void);
773 774
774static inline unsigned long get_debugctlmsr(void) 775static inline unsigned long get_debugctlmsr(void)
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 652fdc9a757..0f73ea42308 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -253,23 +253,28 @@ static char __cpuinit *table_lookup_model(struct cpuinfo_x86 *c)
253 253
254__u32 cleared_cpu_caps[NCAPINTS] __cpuinitdata; 254__u32 cleared_cpu_caps[NCAPINTS] __cpuinitdata;
255 255
256void load_percpu_segment(int cpu)
257{
258#ifdef CONFIG_X86_32
259 loadsegment(fs, __KERNEL_PERCPU);
260#else
261 loadsegment(gs, 0);
262 wrmsrl(MSR_GS_BASE, (unsigned long)per_cpu(irq_stack_union.gs_base, cpu));
263#endif
264}
265
256/* Current gdt points %fs at the "master" per-cpu area: after this, 266/* Current gdt points %fs at the "master" per-cpu area: after this,
257 * it's on the real one. */ 267 * it's on the real one. */
258void switch_to_new_gdt(void) 268void switch_to_new_gdt(int cpu)
259{ 269{
260 struct desc_ptr gdt_descr; 270 struct desc_ptr gdt_descr;
261 int cpu = smp_processor_id();
262 271
263 gdt_descr.address = (long)get_cpu_gdt_table(cpu); 272 gdt_descr.address = (long)get_cpu_gdt_table(cpu);
264 gdt_descr.size = GDT_SIZE - 1; 273 gdt_descr.size = GDT_SIZE - 1;
265 load_gdt(&gdt_descr); 274 load_gdt(&gdt_descr);
266 /* Reload the per-cpu base */ 275 /* Reload the per-cpu base */
267#ifdef CONFIG_X86_32 276
268 loadsegment(fs, __KERNEL_PERCPU); 277 load_percpu_segment(cpu);
269#else
270 loadsegment(gs, 0);
271 wrmsrl(MSR_GS_BASE, (unsigned long)per_cpu(irq_stack_union.gs_base, cpu));
272#endif
273} 278}
274 279
275static struct cpu_dev *cpu_devs[X86_VENDOR_NUM] = {}; 280static struct cpu_dev *cpu_devs[X86_VENDOR_NUM] = {};
@@ -993,7 +998,7 @@ void __cpuinit cpu_init(void)
993 * and set up the GDT descriptor: 998 * and set up the GDT descriptor:
994 */ 999 */
995 1000
996 switch_to_new_gdt(); 1001 switch_to_new_gdt(cpu);
997 loadsegment(fs, 0); 1002 loadsegment(fs, 0);
998 1003
999 load_idt((const struct desc_ptr *)&idt_descr); 1004 load_idt((const struct desc_ptr *)&idt_descr);
@@ -1098,7 +1103,7 @@ void __cpuinit cpu_init(void)
1098 clear_in_cr4(X86_CR4_VME|X86_CR4_PVI|X86_CR4_TSD|X86_CR4_DE); 1103 clear_in_cr4(X86_CR4_VME|X86_CR4_PVI|X86_CR4_TSD|X86_CR4_DE);
1099 1104
1100 load_idt(&idt_descr); 1105 load_idt(&idt_descr);
1101 switch_to_new_gdt(); 1106 switch_to_new_gdt(cpu);
1102 1107
1103 /* 1108 /*
1104 * Set up and load the per-CPU TSS and LDT 1109 * Set up and load the per-CPU TSS and LDT
diff --git a/arch/x86/kernel/setup_percpu.c b/arch/x86/kernel/setup_percpu.c
index 0d1e7ac439f..ef91747bbed 100644
--- a/arch/x86/kernel/setup_percpu.c
+++ b/arch/x86/kernel/setup_percpu.c
@@ -122,7 +122,7 @@ void __init setup_per_cpu_areas(void)
122 * area. Reload any changed state for the boot CPU. 122 * area. Reload any changed state for the boot CPU.
123 */ 123 */
124 if (cpu == boot_cpu_id) 124 if (cpu == boot_cpu_id)
125 switch_to_new_gdt(); 125 switch_to_new_gdt(cpu);
126 126
127 DBG("PERCPU: cpu %4d %p\n", cpu, ptr); 127 DBG("PERCPU: cpu %4d %p\n", cpu, ptr);
128 } 128 }
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index f9dbcff4354..612d3c74f6a 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -1185,7 +1185,7 @@ out:
1185void __init native_smp_prepare_boot_cpu(void) 1185void __init native_smp_prepare_boot_cpu(void)
1186{ 1186{
1187 int me = smp_processor_id(); 1187 int me = smp_processor_id();
1188 switch_to_new_gdt(); 1188 switch_to_new_gdt(me);
1189 /* already set me in cpu_online_mask in boot_cpu_init() */ 1189 /* already set me in cpu_online_mask in boot_cpu_init() */
1190 cpumask_set_cpu(me, cpu_callout_mask); 1190 cpumask_set_cpu(me, cpu_callout_mask);
1191 per_cpu(cpu_state, me) = CPU_ONLINE; 1191 per_cpu(cpu_state, me) = CPU_ONLINE;
diff --git a/arch/x86/kernel/tlb_uv.c b/arch/x86/kernel/tlb_uv.c
index 89fce1b6d01..f4b2f27d19b 100644
--- a/arch/x86/kernel/tlb_uv.c
+++ b/arch/x86/kernel/tlb_uv.c
@@ -259,7 +259,7 @@ const struct cpumask *uv_flush_send_and_wait(int cpu, int this_blade,
259 * the cpu's, all of which are still in the mask. 259 * the cpu's, all of which are still in the mask.
260 */ 260 */
261 __get_cpu_var(ptcstats).ptc_i++; 261 __get_cpu_var(ptcstats).ptc_i++;
262 return 0; 262 return flush_mask;
263 } 263 }
264 264
265 /* 265 /*
diff --git a/arch/x86/mach-voyager/voyager_smp.c b/arch/x86/mach-voyager/voyager_smp.c
index 331cd6d5648..58c7cac3440 100644
--- a/arch/x86/mach-voyager/voyager_smp.c
+++ b/arch/x86/mach-voyager/voyager_smp.c
@@ -1746,12 +1746,13 @@ static void __init voyager_smp_prepare_cpus(unsigned int max_cpus)
1746 1746
1747static void __cpuinit voyager_smp_prepare_boot_cpu(void) 1747static void __cpuinit voyager_smp_prepare_boot_cpu(void)
1748{ 1748{
1749 switch_to_new_gdt(); 1749 int cpu = smp_processor_id();
1750 switch_to_new_gdt(cpu);
1750 1751
1751 cpu_set(smp_processor_id(), cpu_online_map); 1752 cpu_set(cpu, cpu_online_map);
1752 cpu_set(smp_processor_id(), cpu_callout_map); 1753 cpu_set(cpu, cpu_callout_map);
1753 cpu_set(smp_processor_id(), cpu_possible_map); 1754 cpu_set(cpu, cpu_possible_map);
1754 cpu_set(smp_processor_id(), cpu_present_map); 1755 cpu_set(cpu, cpu_present_map);
1755} 1756}
1756 1757
1757static int __cpuinit voyager_cpu_up(unsigned int cpu) 1758static int __cpuinit voyager_cpu_up(unsigned int cpu)
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index bef941f6145..fe19c88a502 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1647,6 +1647,9 @@ asmlinkage void __init xen_start_kernel(void)
1647 have_vcpu_info_placement = 0; 1647 have_vcpu_info_placement = 0;
1648#endif 1648#endif
1649 1649
1650 /* setup percpu state */
1651 load_percpu_segment(0);
1652
1650 xen_smp_init(); 1653 xen_smp_init();
1651 1654
1652 /* Get mfn list */ 1655 /* Get mfn list */
diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
index 7735e3dd359..88d5d5ec6be 100644
--- a/arch/x86/xen/smp.c
+++ b/arch/x86/xen/smp.c
@@ -170,7 +170,8 @@ static void __init xen_smp_prepare_boot_cpu(void)
170 170
171 /* We've switched to the "real" per-cpu gdt, so make sure the 171 /* We've switched to the "real" per-cpu gdt, so make sure the
172 old memory can be recycled */ 172 old memory can be recycled */
173 make_lowmem_page_readwrite(&per_cpu_var(gdt_page)); 173 make_lowmem_page_readwrite(__per_cpu_load +
174 (unsigned long)&per_cpu_var(gdt_page));
174 175
175 xen_setup_vcpu_info_placement(); 176 xen_setup_vcpu_info_placement();
176} 177}
@@ -235,6 +236,8 @@ cpu_initialize_context(unsigned int cpu, struct task_struct *idle)
235 ctxt->user_regs.ss = __KERNEL_DS; 236 ctxt->user_regs.ss = __KERNEL_DS;
236#ifdef CONFIG_X86_32 237#ifdef CONFIG_X86_32
237 ctxt->user_regs.fs = __KERNEL_PERCPU; 238 ctxt->user_regs.fs = __KERNEL_PERCPU;
239#else
240 ctxt->gs_base_kernel = per_cpu_offset(cpu);
238#endif 241#endif
239 ctxt->user_regs.eip = (unsigned long)cpu_bringup_and_idle; 242 ctxt->user_regs.eip = (unsigned long)cpu_bringup_and_idle;
240 ctxt->user_regs.eflags = 0x1000; /* IOPL_RING1 */ 243 ctxt->user_regs.eflags = 0x1000; /* IOPL_RING1 */
diff --git a/block/blk-barrier.c b/block/blk-barrier.c
index 8eba4e43bb0..f7dae57e6ca 100644
--- a/block/blk-barrier.c
+++ b/block/blk-barrier.c
@@ -302,7 +302,7 @@ static void bio_end_empty_barrier(struct bio *bio, int err)
302 * Description: 302 * Description:
303 * Issue a flush for the block device in question. Caller can supply 303 * Issue a flush for the block device in question. Caller can supply
304 * room for storing the error offset in case of a flush error, if they 304 * room for storing the error offset in case of a flush error, if they
305 * wish to. Caller must run wait_for_completion() on its own. 305 * wish to.
306 */ 306 */
307int blkdev_issue_flush(struct block_device *bdev, sector_t *error_sector) 307int blkdev_issue_flush(struct block_device *bdev, sector_t *error_sector)
308{ 308{
diff --git a/block/blk-core.c b/block/blk-core.c
index a824e49c0d0..ca69f3d9410 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -64,11 +64,12 @@ static struct workqueue_struct *kblockd_workqueue;
64 64
65static void drive_stat_acct(struct request *rq, int new_io) 65static void drive_stat_acct(struct request *rq, int new_io)
66{ 66{
67 struct gendisk *disk = rq->rq_disk;
67 struct hd_struct *part; 68 struct hd_struct *part;
68 int rw = rq_data_dir(rq); 69 int rw = rq_data_dir(rq);
69 int cpu; 70 int cpu;
70 71
71 if (!blk_fs_request(rq) || !rq->rq_disk) 72 if (!blk_fs_request(rq) || !disk || !blk_queue_io_stat(disk->queue))
72 return; 73 return;
73 74
74 cpu = part_stat_lock(); 75 cpu = part_stat_lock();
@@ -599,8 +600,7 @@ blk_init_queue_node(request_fn_proc *rfn, spinlock_t *lock, int node_id)
599 q->request_fn = rfn; 600 q->request_fn = rfn;
600 q->prep_rq_fn = NULL; 601 q->prep_rq_fn = NULL;
601 q->unplug_fn = generic_unplug_device; 602 q->unplug_fn = generic_unplug_device;
602 q->queue_flags = (1 << QUEUE_FLAG_CLUSTER | 603 q->queue_flags = QUEUE_FLAG_DEFAULT;
603 1 << QUEUE_FLAG_STACKABLE);
604 q->queue_lock = lock; 604 q->queue_lock = lock;
605 605
606 blk_queue_segment_boundary(q, BLK_SEG_BOUNDARY_MASK); 606 blk_queue_segment_boundary(q, BLK_SEG_BOUNDARY_MASK);
@@ -1125,6 +1125,8 @@ void init_request_from_bio(struct request *req, struct bio *bio)
1125 1125
1126 if (bio_sync(bio)) 1126 if (bio_sync(bio))
1127 req->cmd_flags |= REQ_RW_SYNC; 1127 req->cmd_flags |= REQ_RW_SYNC;
1128 if (bio_unplug(bio))
1129 req->cmd_flags |= REQ_UNPLUG;
1128 if (bio_rw_meta(bio)) 1130 if (bio_rw_meta(bio))
1129 req->cmd_flags |= REQ_RW_META; 1131 req->cmd_flags |= REQ_RW_META;
1130 1132
@@ -1141,6 +1143,7 @@ static int __make_request(struct request_queue *q, struct bio *bio)
1141 int el_ret, nr_sectors; 1143 int el_ret, nr_sectors;
1142 const unsigned short prio = bio_prio(bio); 1144 const unsigned short prio = bio_prio(bio);
1143 const int sync = bio_sync(bio); 1145 const int sync = bio_sync(bio);
1146 const int unplug = bio_unplug(bio);
1144 int rw_flags; 1147 int rw_flags;
1145 1148
1146 nr_sectors = bio_sectors(bio); 1149 nr_sectors = bio_sectors(bio);
@@ -1244,7 +1247,7 @@ get_rq:
1244 blk_plug_device(q); 1247 blk_plug_device(q);
1245 add_request(q, req); 1248 add_request(q, req);
1246out: 1249out:
1247 if (sync || blk_queue_nonrot(q)) 1250 if (unplug || blk_queue_nonrot(q))
1248 __generic_unplug_device(q); 1251 __generic_unplug_device(q);
1249 spin_unlock_irq(q->queue_lock); 1252 spin_unlock_irq(q->queue_lock);
1250 return 0; 1253 return 0;
@@ -1448,6 +1451,11 @@ static inline void __generic_make_request(struct bio *bio)
1448 err = -EOPNOTSUPP; 1451 err = -EOPNOTSUPP;
1449 goto end_io; 1452 goto end_io;
1450 } 1453 }
1454 if (bio_barrier(bio) && bio_has_data(bio) &&
1455 (q->next_ordered == QUEUE_ORDERED_NONE)) {
1456 err = -EOPNOTSUPP;
1457 goto end_io;
1458 }
1451 1459
1452 ret = q->make_request_fn(q, bio); 1460 ret = q->make_request_fn(q, bio);
1453 } while (ret); 1461 } while (ret);
@@ -1655,6 +1663,55 @@ void blkdev_dequeue_request(struct request *req)
1655} 1663}
1656EXPORT_SYMBOL(blkdev_dequeue_request); 1664EXPORT_SYMBOL(blkdev_dequeue_request);
1657 1665
1666static void blk_account_io_completion(struct request *req, unsigned int bytes)
1667{
1668 struct gendisk *disk = req->rq_disk;
1669
1670 if (!disk || !blk_queue_io_stat(disk->queue))
1671 return;
1672
1673 if (blk_fs_request(req)) {
1674 const int rw = rq_data_dir(req);
1675 struct hd_struct *part;
1676 int cpu;
1677
1678 cpu = part_stat_lock();
1679 part = disk_map_sector_rcu(req->rq_disk, req->sector);
1680 part_stat_add(cpu, part, sectors[rw], bytes >> 9);
1681 part_stat_unlock();
1682 }
1683}
1684
1685static void blk_account_io_done(struct request *req)
1686{
1687 struct gendisk *disk = req->rq_disk;
1688
1689 if (!disk || !blk_queue_io_stat(disk->queue))
1690 return;
1691
1692 /*
1693 * Account IO completion. bar_rq isn't accounted as a normal
1694 * IO on queueing nor completion. Accounting the containing
1695 * request is enough.
1696 */
1697 if (blk_fs_request(req) && req != &req->q->bar_rq) {
1698 unsigned long duration = jiffies - req->start_time;
1699 const int rw = rq_data_dir(req);
1700 struct hd_struct *part;
1701 int cpu;
1702
1703 cpu = part_stat_lock();
1704 part = disk_map_sector_rcu(disk, req->sector);
1705
1706 part_stat_inc(cpu, part, ios[rw]);
1707 part_stat_add(cpu, part, ticks[rw], duration);
1708 part_round_stats(cpu, part);
1709 part_dec_in_flight(part);
1710
1711 part_stat_unlock();
1712 }
1713}
1714
1658/** 1715/**
1659 * __end_that_request_first - end I/O on a request 1716 * __end_that_request_first - end I/O on a request
1660 * @req: the request being processed 1717 * @req: the request being processed
@@ -1690,16 +1747,7 @@ static int __end_that_request_first(struct request *req, int error,
1690 (unsigned long long)req->sector); 1747 (unsigned long long)req->sector);
1691 } 1748 }
1692 1749
1693 if (blk_fs_request(req) && req->rq_disk) { 1750 blk_account_io_completion(req, nr_bytes);
1694 const int rw = rq_data_dir(req);
1695 struct hd_struct *part;
1696 int cpu;
1697
1698 cpu = part_stat_lock();
1699 part = disk_map_sector_rcu(req->rq_disk, req->sector);
1700 part_stat_add(cpu, part, sectors[rw], nr_bytes >> 9);
1701 part_stat_unlock();
1702 }
1703 1751
1704 total_bytes = bio_nbytes = 0; 1752 total_bytes = bio_nbytes = 0;
1705 while ((bio = req->bio) != NULL) { 1753 while ((bio = req->bio) != NULL) {
@@ -1779,8 +1827,6 @@ static int __end_that_request_first(struct request *req, int error,
1779 */ 1827 */
1780static void end_that_request_last(struct request *req, int error) 1828static void end_that_request_last(struct request *req, int error)
1781{ 1829{
1782 struct gendisk *disk = req->rq_disk;
1783
1784 if (blk_rq_tagged(req)) 1830 if (blk_rq_tagged(req))
1785 blk_queue_end_tag(req->q, req); 1831 blk_queue_end_tag(req->q, req);
1786 1832
@@ -1792,27 +1838,7 @@ static void end_that_request_last(struct request *req, int error)
1792 1838
1793 blk_delete_timer(req); 1839 blk_delete_timer(req);
1794 1840
1795 /* 1841 blk_account_io_done(req);
1796 * Account IO completion. bar_rq isn't accounted as a normal
1797 * IO on queueing nor completion. Accounting the containing
1798 * request is enough.
1799 */
1800 if (disk && blk_fs_request(req) && req != &req->q->bar_rq) {
1801 unsigned long duration = jiffies - req->start_time;
1802 const int rw = rq_data_dir(req);
1803 struct hd_struct *part;
1804 int cpu;
1805
1806 cpu = part_stat_lock();
1807 part = disk_map_sector_rcu(disk, req->sector);
1808
1809 part_stat_inc(cpu, part, ios[rw]);
1810 part_stat_add(cpu, part, ticks[rw], duration);
1811 part_round_stats(cpu, part);
1812 part_dec_in_flight(part);
1813
1814 part_stat_unlock();
1815 }
1816 1842
1817 if (req->end_io) 1843 if (req->end_io)
1818 req->end_io(req, error); 1844 req->end_io(req, error);
diff --git a/block/blk-integrity.c b/block/blk-integrity.c
index 61a8e2f8fdd..91fa8e06b6a 100644
--- a/block/blk-integrity.c
+++ b/block/blk-integrity.c
@@ -309,24 +309,24 @@ static struct kobj_type integrity_ktype = {
309/** 309/**
310 * blk_integrity_register - Register a gendisk as being integrity-capable 310 * blk_integrity_register - Register a gendisk as being integrity-capable
311 * @disk: struct gendisk pointer to make integrity-aware 311 * @disk: struct gendisk pointer to make integrity-aware
312 * @template: integrity profile 312 * @template: optional integrity profile to register
313 * 313 *
314 * Description: When a device needs to advertise itself as being able 314 * Description: When a device needs to advertise itself as being able
315 * to send/receive integrity metadata it must use this function to 315 * to send/receive integrity metadata it must use this function to
316 * register the capability with the block layer. The template is a 316 * register the capability with the block layer. The template is a
317 * blk_integrity struct with values appropriate for the underlying 317 * blk_integrity struct with values appropriate for the underlying
318 * hardware. See Documentation/block/data-integrity.txt. 318 * hardware. If template is NULL the new profile is allocated but
319 * not filled out. See Documentation/block/data-integrity.txt.
319 */ 320 */
320int blk_integrity_register(struct gendisk *disk, struct blk_integrity *template) 321int blk_integrity_register(struct gendisk *disk, struct blk_integrity *template)
321{ 322{
322 struct blk_integrity *bi; 323 struct blk_integrity *bi;
323 324
324 BUG_ON(disk == NULL); 325 BUG_ON(disk == NULL);
325 BUG_ON(template == NULL);
326 326
327 if (disk->integrity == NULL) { 327 if (disk->integrity == NULL) {
328 bi = kmem_cache_alloc(integrity_cachep, 328 bi = kmem_cache_alloc(integrity_cachep,
329 GFP_KERNEL | __GFP_ZERO); 329 GFP_KERNEL | __GFP_ZERO);
330 if (!bi) 330 if (!bi)
331 return -1; 331 return -1;
332 332
@@ -346,13 +346,16 @@ int blk_integrity_register(struct gendisk *disk, struct blk_integrity *template)
346 bi = disk->integrity; 346 bi = disk->integrity;
347 347
348 /* Use the provided profile as template */ 348 /* Use the provided profile as template */
349 bi->name = template->name; 349 if (template != NULL) {
350 bi->generate_fn = template->generate_fn; 350 bi->name = template->name;
351 bi->verify_fn = template->verify_fn; 351 bi->generate_fn = template->generate_fn;
352 bi->tuple_size = template->tuple_size; 352 bi->verify_fn = template->verify_fn;
353 bi->set_tag_fn = template->set_tag_fn; 353 bi->tuple_size = template->tuple_size;
354 bi->get_tag_fn = template->get_tag_fn; 354 bi->set_tag_fn = template->set_tag_fn;
355 bi->tag_size = template->tag_size; 355 bi->get_tag_fn = template->get_tag_fn;
356 bi->tag_size = template->tag_size;
357 } else
358 bi->name = "unsupported";
356 359
357 return 0; 360 return 0;
358} 361}
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
index a29cb788e40..e29ddfc73cf 100644
--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -130,6 +130,27 @@ static ssize_t queue_max_hw_sectors_show(struct request_queue *q, char *page)
130 return queue_var_show(max_hw_sectors_kb, (page)); 130 return queue_var_show(max_hw_sectors_kb, (page));
131} 131}
132 132
133static ssize_t queue_nonrot_show(struct request_queue *q, char *page)
134{
135 return queue_var_show(!blk_queue_nonrot(q), page);
136}
137
138static ssize_t queue_nonrot_store(struct request_queue *q, const char *page,
139 size_t count)
140{
141 unsigned long nm;
142 ssize_t ret = queue_var_store(&nm, page, count);
143
144 spin_lock_irq(q->queue_lock);
145 if (nm)
146 queue_flag_clear(QUEUE_FLAG_NONROT, q);
147 else
148 queue_flag_set(QUEUE_FLAG_NONROT, q);
149 spin_unlock_irq(q->queue_lock);
150
151 return ret;
152}
153
133static ssize_t queue_nomerges_show(struct request_queue *q, char *page) 154static ssize_t queue_nomerges_show(struct request_queue *q, char *page)
134{ 155{
135 return queue_var_show(blk_queue_nomerges(q), page); 156 return queue_var_show(blk_queue_nomerges(q), page);
@@ -146,8 +167,8 @@ static ssize_t queue_nomerges_store(struct request_queue *q, const char *page,
146 queue_flag_set(QUEUE_FLAG_NOMERGES, q); 167 queue_flag_set(QUEUE_FLAG_NOMERGES, q);
147 else 168 else
148 queue_flag_clear(QUEUE_FLAG_NOMERGES, q); 169 queue_flag_clear(QUEUE_FLAG_NOMERGES, q);
149
150 spin_unlock_irq(q->queue_lock); 170 spin_unlock_irq(q->queue_lock);
171
151 return ret; 172 return ret;
152} 173}
153 174
@@ -176,6 +197,27 @@ queue_rq_affinity_store(struct request_queue *q, const char *page, size_t count)
176 return ret; 197 return ret;
177} 198}
178 199
200static ssize_t queue_iostats_show(struct request_queue *q, char *page)
201{
202 return queue_var_show(blk_queue_io_stat(q), page);
203}
204
205static ssize_t queue_iostats_store(struct request_queue *q, const char *page,
206 size_t count)
207{
208 unsigned long stats;
209 ssize_t ret = queue_var_store(&stats, page, count);
210
211 spin_lock_irq(q->queue_lock);
212 if (stats)
213 queue_flag_set(QUEUE_FLAG_IO_STAT, q);
214 else
215 queue_flag_clear(QUEUE_FLAG_IO_STAT, q);
216 spin_unlock_irq(q->queue_lock);
217
218 return ret;
219}
220
179static struct queue_sysfs_entry queue_requests_entry = { 221static struct queue_sysfs_entry queue_requests_entry = {
180 .attr = {.name = "nr_requests", .mode = S_IRUGO | S_IWUSR }, 222 .attr = {.name = "nr_requests", .mode = S_IRUGO | S_IWUSR },
181 .show = queue_requests_show, 223 .show = queue_requests_show,
@@ -210,6 +252,12 @@ static struct queue_sysfs_entry queue_hw_sector_size_entry = {
210 .show = queue_hw_sector_size_show, 252 .show = queue_hw_sector_size_show,
211}; 253};
212 254
255static struct queue_sysfs_entry queue_nonrot_entry = {
256 .attr = {.name = "rotational", .mode = S_IRUGO | S_IWUSR },
257 .show = queue_nonrot_show,
258 .store = queue_nonrot_store,
259};
260
213static struct queue_sysfs_entry queue_nomerges_entry = { 261static struct queue_sysfs_entry queue_nomerges_entry = {
214 .attr = {.name = "nomerges", .mode = S_IRUGO | S_IWUSR }, 262 .attr = {.name = "nomerges", .mode = S_IRUGO | S_IWUSR },
215 .show = queue_nomerges_show, 263 .show = queue_nomerges_show,
@@ -222,6 +270,12 @@ static struct queue_sysfs_entry queue_rq_affinity_entry = {
222 .store = queue_rq_affinity_store, 270 .store = queue_rq_affinity_store,
223}; 271};
224 272
273static struct queue_sysfs_entry queue_iostats_entry = {
274 .attr = {.name = "iostats", .mode = S_IRUGO | S_IWUSR },
275 .show = queue_iostats_show,
276 .store = queue_iostats_store,
277};
278
225static struct attribute *default_attrs[] = { 279static struct attribute *default_attrs[] = {
226 &queue_requests_entry.attr, 280 &queue_requests_entry.attr,
227 &queue_ra_entry.attr, 281 &queue_ra_entry.attr,
@@ -229,8 +283,10 @@ static struct attribute *default_attrs[] = {
229 &queue_max_sectors_entry.attr, 283 &queue_max_sectors_entry.attr,
230 &queue_iosched_entry.attr, 284 &queue_iosched_entry.attr,
231 &queue_hw_sector_size_entry.attr, 285 &queue_hw_sector_size_entry.attr,
286 &queue_nonrot_entry.attr,
232 &queue_nomerges_entry.attr, 287 &queue_nomerges_entry.attr,
233 &queue_rq_affinity_entry.attr, 288 &queue_rq_affinity_entry.attr,
289 &queue_iostats_entry.attr,
234 NULL, 290 NULL,
235}; 291};
236 292
diff --git a/block/blktrace.c b/block/blktrace.c
index b0a2cae886d..39cc3bfe56e 100644
--- a/block/blktrace.c
+++ b/block/blktrace.c
@@ -187,59 +187,12 @@ static void __blk_add_trace(struct blk_trace *bt, sector_t sector, int bytes,
187 187
188static struct dentry *blk_tree_root; 188static struct dentry *blk_tree_root;
189static DEFINE_MUTEX(blk_tree_mutex); 189static DEFINE_MUTEX(blk_tree_mutex);
190static unsigned int root_users;
191
192static inline void blk_remove_root(void)
193{
194 if (blk_tree_root) {
195 debugfs_remove(blk_tree_root);
196 blk_tree_root = NULL;
197 }
198}
199
200static void blk_remove_tree(struct dentry *dir)
201{
202 mutex_lock(&blk_tree_mutex);
203 debugfs_remove(dir);
204 if (--root_users == 0)
205 blk_remove_root();
206 mutex_unlock(&blk_tree_mutex);
207}
208
209static struct dentry *blk_create_tree(const char *blk_name)
210{
211 struct dentry *dir = NULL;
212 int created = 0;
213
214 mutex_lock(&blk_tree_mutex);
215
216 if (!blk_tree_root) {
217 blk_tree_root = debugfs_create_dir("block", NULL);
218 if (!blk_tree_root)
219 goto err;
220 created = 1;
221 }
222
223 dir = debugfs_create_dir(blk_name, blk_tree_root);
224 if (dir)
225 root_users++;
226 else {
227 /* Delete root only if we created it */
228 if (created)
229 blk_remove_root();
230 }
231
232err:
233 mutex_unlock(&blk_tree_mutex);
234 return dir;
235}
236 190
237static void blk_trace_cleanup(struct blk_trace *bt) 191static void blk_trace_cleanup(struct blk_trace *bt)
238{ 192{
239 relay_close(bt->rchan);
240 debugfs_remove(bt->msg_file); 193 debugfs_remove(bt->msg_file);
241 debugfs_remove(bt->dropped_file); 194 debugfs_remove(bt->dropped_file);
242 blk_remove_tree(bt->dir); 195 relay_close(bt->rchan);
243 free_percpu(bt->sequence); 196 free_percpu(bt->sequence);
244 free_percpu(bt->msg_data); 197 free_percpu(bt->msg_data);
245 kfree(bt); 198 kfree(bt);
@@ -346,7 +299,18 @@ static int blk_subbuf_start_callback(struct rchan_buf *buf, void *subbuf,
346 299
347static int blk_remove_buf_file_callback(struct dentry *dentry) 300static int blk_remove_buf_file_callback(struct dentry *dentry)
348{ 301{
302 struct dentry *parent = dentry->d_parent;
349 debugfs_remove(dentry); 303 debugfs_remove(dentry);
304
305 /*
306 * this will fail for all but the last file, but that is ok. what we
307 * care about is the top level buts->name directory going away, when
308 * the last trace file is gone. Then we don't have to rmdir() that
309 * manually on trace stop, so it nicely solves the issue with
310 * force killing of running traces.
311 */
312
313 debugfs_remove(parent);
350 return 0; 314 return 0;
351} 315}
352 316
@@ -404,7 +368,15 @@ int do_blk_trace_setup(struct request_queue *q, char *name, dev_t dev,
404 goto err; 368 goto err;
405 369
406 ret = -ENOENT; 370 ret = -ENOENT;
407 dir = blk_create_tree(buts->name); 371
372 if (!blk_tree_root) {
373 blk_tree_root = debugfs_create_dir("block", NULL);
374 if (!blk_tree_root)
375 return -ENOMEM;
376 }
377
378 dir = debugfs_create_dir(buts->name, blk_tree_root);
379
408 if (!dir) 380 if (!dir)
409 goto err; 381 goto err;
410 382
@@ -458,8 +430,6 @@ probe_err:
458 atomic_dec(&blk_probes_ref); 430 atomic_dec(&blk_probes_ref);
459 mutex_unlock(&blk_probe_mutex); 431 mutex_unlock(&blk_probe_mutex);
460err: 432err:
461 if (dir)
462 blk_remove_tree(dir);
463 if (bt) { 433 if (bt) {
464 if (bt->msg_file) 434 if (bt->msg_file)
465 debugfs_remove(bt->msg_file); 435 debugfs_remove(bt->msg_file);
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index e8525fa7282..664ebfd092e 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -84,6 +84,11 @@ struct cfq_data {
84 */ 84 */
85 struct cfq_rb_root service_tree; 85 struct cfq_rb_root service_tree;
86 unsigned int busy_queues; 86 unsigned int busy_queues;
87 /*
88 * Used to track any pending rt requests so we can pre-empt current
89 * non-RT cfqq in service when this value is non-zero.
90 */
91 unsigned int busy_rt_queues;
87 92
88 int rq_in_driver; 93 int rq_in_driver;
89 int sync_flight; 94 int sync_flight;
@@ -562,6 +567,8 @@ static void cfq_add_cfqq_rr(struct cfq_data *cfqd, struct cfq_queue *cfqq)
562 BUG_ON(cfq_cfqq_on_rr(cfqq)); 567 BUG_ON(cfq_cfqq_on_rr(cfqq));
563 cfq_mark_cfqq_on_rr(cfqq); 568 cfq_mark_cfqq_on_rr(cfqq);
564 cfqd->busy_queues++; 569 cfqd->busy_queues++;
570 if (cfq_class_rt(cfqq))
571 cfqd->busy_rt_queues++;
565 572
566 cfq_resort_rr_list(cfqd, cfqq); 573 cfq_resort_rr_list(cfqd, cfqq);
567} 574}
@@ -581,6 +588,8 @@ static void cfq_del_cfqq_rr(struct cfq_data *cfqd, struct cfq_queue *cfqq)
581 588
582 BUG_ON(!cfqd->busy_queues); 589 BUG_ON(!cfqd->busy_queues);
583 cfqd->busy_queues--; 590 cfqd->busy_queues--;
591 if (cfq_class_rt(cfqq))
592 cfqd->busy_rt_queues--;
584} 593}
585 594
586/* 595/*
@@ -1005,6 +1014,20 @@ static struct cfq_queue *cfq_select_queue(struct cfq_data *cfqd)
1005 goto expire; 1014 goto expire;
1006 1015
1007 /* 1016 /*
1017 * If we have a RT cfqq waiting, then we pre-empt the current non-rt
1018 * cfqq.
1019 */
1020 if (!cfq_class_rt(cfqq) && cfqd->busy_rt_queues) {
1021 /*
1022 * We simulate this as cfqq timed out so that it gets to bank
1023 * the remaining of its time slice.
1024 */
1025 cfq_log_cfqq(cfqd, cfqq, "preempt");
1026 cfq_slice_expired(cfqd, 1);
1027 goto new_queue;
1028 }
1029
1030 /*
1008 * The active queue has requests and isn't expired, allow it to 1031 * The active queue has requests and isn't expired, allow it to
1009 * dispatch. 1032 * dispatch.
1010 */ 1033 */
@@ -1067,6 +1090,13 @@ __cfq_dispatch_requests(struct cfq_data *cfqd, struct cfq_queue *cfqq,
1067 if (RB_EMPTY_ROOT(&cfqq->sort_list)) 1090 if (RB_EMPTY_ROOT(&cfqq->sort_list))
1068 break; 1091 break;
1069 1092
1093 /*
1094 * If there is a non-empty RT cfqq waiting for current
1095 * cfqq's timeslice to complete, pre-empt this cfqq
1096 */
1097 if (!cfq_class_rt(cfqq) && cfqd->busy_rt_queues)
1098 break;
1099
1070 } while (dispatched < max_dispatch); 1100 } while (dispatched < max_dispatch);
1071 1101
1072 /* 1102 /*
@@ -1801,6 +1831,12 @@ cfq_should_preempt(struct cfq_data *cfqd, struct cfq_queue *new_cfqq,
1801 if (rq_is_meta(rq) && !cfqq->meta_pending) 1831 if (rq_is_meta(rq) && !cfqq->meta_pending)
1802 return 1; 1832 return 1;
1803 1833
1834 /*
1835 * Allow an RT request to pre-empt an ongoing non-RT cfqq timeslice.
1836 */
1837 if (cfq_class_rt(new_cfqq) && !cfq_class_rt(cfqq))
1838 return 1;
1839
1804 if (!cfqd->active_cic || !cfq_cfqq_wait_request(cfqq)) 1840 if (!cfqd->active_cic || !cfq_cfqq_wait_request(cfqq))
1805 return 0; 1841 return 0;
1806 1842
@@ -1870,7 +1906,8 @@ cfq_rq_enqueued(struct cfq_data *cfqd, struct cfq_queue *cfqq,
1870 /* 1906 /*
1871 * not the active queue - expire current slice if it is 1907 * not the active queue - expire current slice if it is
1872 * idle and has expired it's mean thinktime or this new queue 1908 * idle and has expired it's mean thinktime or this new queue
1873 * has some old slice time left and is of higher priority 1909 * has some old slice time left and is of higher priority or
1910 * this new queue is RT and the current one is BE
1874 */ 1911 */
1875 cfq_preempt_queue(cfqd, cfqq); 1912 cfq_preempt_queue(cfqd, cfqq);
1876 cfq_mark_cfqq_must_dispatch(cfqq); 1913 cfq_mark_cfqq_must_dispatch(cfqq);
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 26474c92193..c986978ce76 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -31,7 +31,7 @@
31 31
32char e1000_driver_name[] = "e1000"; 32char e1000_driver_name[] = "e1000";
33static char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver"; 33static char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver";
34#define DRV_VERSION "7.3.20-k3-NAPI" 34#define DRV_VERSION "7.3.21-k3-NAPI"
35const char e1000_driver_version[] = DRV_VERSION; 35const char e1000_driver_version[] = DRV_VERSION;
36static const char e1000_copyright[] = "Copyright (c) 1999-2006 Intel Corporation."; 36static const char e1000_copyright[] = "Copyright (c) 1999-2006 Intel Corporation.";
37 37
@@ -3712,7 +3712,7 @@ static irqreturn_t e1000_intr(int irq, void *data)
3712 struct e1000_hw *hw = &adapter->hw; 3712 struct e1000_hw *hw = &adapter->hw;
3713 u32 rctl, icr = er32(ICR); 3713 u32 rctl, icr = er32(ICR);
3714 3714
3715 if (unlikely(!icr)) 3715 if (unlikely((!icr) || test_bit(__E1000_RESETTING, &adapter->flags)))
3716 return IRQ_NONE; /* Not our interrupt */ 3716 return IRQ_NONE; /* Not our interrupt */
3717 3717
3718 /* IMS will not auto-mask if INT_ASSERTED is not set, and if it is 3718 /* IMS will not auto-mask if INT_ASSERTED is not set, and if it is
diff --git a/drivers/net/gianfar_mii.c b/drivers/net/gianfar_mii.c
index f3706e415b4..f49a426ad68 100644
--- a/drivers/net/gianfar_mii.c
+++ b/drivers/net/gianfar_mii.c
@@ -234,6 +234,8 @@ static int gfar_mdio_probe(struct of_device *ofdev,
234 if (NULL == new_bus) 234 if (NULL == new_bus)
235 return -ENOMEM; 235 return -ENOMEM;
236 236
237 device_init_wakeup(&ofdev->dev, 1);
238
237 new_bus->name = "Gianfar MII Bus", 239 new_bus->name = "Gianfar MII Bus",
238 new_bus->read = &gfar_mdio_read, 240 new_bus->read = &gfar_mdio_read,
239 new_bus->write = &gfar_mdio_write, 241 new_bus->write = &gfar_mdio_write,
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index a75a31005fd..9c78c963b72 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -210,7 +210,7 @@
210#define MAX_CMD_DESCRIPTORS_HOST 1024 210#define MAX_CMD_DESCRIPTORS_HOST 1024
211#define MAX_RCV_DESCRIPTORS_1G 2048 211#define MAX_RCV_DESCRIPTORS_1G 2048
212#define MAX_RCV_DESCRIPTORS_10G 4096 212#define MAX_RCV_DESCRIPTORS_10G 4096
213#define MAX_JUMBO_RCV_DESCRIPTORS 512 213#define MAX_JUMBO_RCV_DESCRIPTORS 1024
214#define MAX_LRO_RCV_DESCRIPTORS 8 214#define MAX_LRO_RCV_DESCRIPTORS 8
215#define MAX_RCVSTATUS_DESCRIPTORS MAX_RCV_DESCRIPTORS 215#define MAX_RCVSTATUS_DESCRIPTORS MAX_RCV_DESCRIPTORS
216#define MAX_JUMBO_RCV_DESC MAX_JUMBO_RCV_DESCRIPTORS 216#define MAX_JUMBO_RCV_DESC MAX_JUMBO_RCV_DESCRIPTORS
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c
index ca7c8d8050c..ffd37bea162 100644
--- a/drivers/net/netxen/netxen_nic_init.c
+++ b/drivers/net/netxen/netxen_nic_init.c
@@ -947,8 +947,10 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose)
947 } 947 }
948 for (i = 0; i < n; i++) { 948 for (i = 0; i < n; i++) {
949 if (netxen_rom_fast_read(adapter, 8*i + 4*offset, &val) != 0 || 949 if (netxen_rom_fast_read(adapter, 8*i + 4*offset, &val) != 0 ||
950 netxen_rom_fast_read(adapter, 8*i + 4*offset + 4, &addr) != 0) 950 netxen_rom_fast_read(adapter, 8*i + 4*offset + 4, &addr) != 0) {
951 kfree(buf);
951 return -EIO; 952 return -EIO;
953 }
952 954
953 buf[i].addr = addr; 955 buf[i].addr = addr;
954 buf[i].data = val; 956 buf[i].data = val;
diff --git a/drivers/net/r6040.c b/drivers/net/r6040.c
index 72fd9e97c19..b2dcdb5ed8b 100644
--- a/drivers/net/r6040.c
+++ b/drivers/net/r6040.c
@@ -438,7 +438,6 @@ static void r6040_down(struct net_device *dev)
438{ 438{
439 struct r6040_private *lp = netdev_priv(dev); 439 struct r6040_private *lp = netdev_priv(dev);
440 void __iomem *ioaddr = lp->base; 440 void __iomem *ioaddr = lp->base;
441 struct pci_dev *pdev = lp->pdev;
442 int limit = 2048; 441 int limit = 2048;
443 u16 *adrp; 442 u16 *adrp;
444 u16 cmd; 443 u16 cmd;
diff --git a/drivers/net/skfp/skfddi.c b/drivers/net/skfp/skfddi.c
index 607efeaf0bc..9a00e5566af 100644
--- a/drivers/net/skfp/skfddi.c
+++ b/drivers/net/skfp/skfddi.c
@@ -1003,9 +1003,9 @@ static int skfp_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
1003 break; 1003 break;
1004 case SKFP_CLR_STATS: /* Zero out the driver statistics */ 1004 case SKFP_CLR_STATS: /* Zero out the driver statistics */
1005 if (!capable(CAP_NET_ADMIN)) { 1005 if (!capable(CAP_NET_ADMIN)) {
1006 memset(&lp->MacStat, 0, sizeof(lp->MacStat));
1007 } else {
1008 status = -EPERM; 1006 status = -EPERM;
1007 } else {
1008 memset(&lp->MacStat, 0, sizeof(lp->MacStat));
1009 } 1009 }
1010 break; 1010 break;
1011 default: 1011 default:
diff --git a/drivers/net/smsc911x.c b/drivers/net/smsc911x.c
index f513bdf1c88..783c1a7b869 100644
--- a/drivers/net/smsc911x.c
+++ b/drivers/net/smsc911x.c
@@ -953,7 +953,7 @@ smsc911x_rx_fastforward(struct smsc911x_data *pdata, unsigned int pktbytes)
953 do { 953 do {
954 udelay(1); 954 udelay(1);
955 val = smsc911x_reg_read(pdata, RX_DP_CTRL); 955 val = smsc911x_reg_read(pdata, RX_DP_CTRL);
956 } while (timeout-- && (val & RX_DP_CTRL_RX_FFWD_)); 956 } while (--timeout && (val & RX_DP_CTRL_RX_FFWD_));
957 957
958 if (unlikely(timeout == 0)) 958 if (unlikely(timeout == 0))
959 SMSC_WARNING(HW, "Timed out waiting for " 959 SMSC_WARNING(HW, "Timed out waiting for "
diff --git a/drivers/net/smsc9420.c b/drivers/net/smsc9420.c
index c14a4c6452c..d801900a503 100644
--- a/drivers/net/smsc9420.c
+++ b/drivers/net/smsc9420.c
@@ -1378,6 +1378,7 @@ static int smsc9420_open(struct net_device *dev)
1378 1378
1379 /* test the IRQ connection to the ISR */ 1379 /* test the IRQ connection to the ISR */
1380 smsc_dbg(IFUP, "Testing ISR using IRQ %d", dev->irq); 1380 smsc_dbg(IFUP, "Testing ISR using IRQ %d", dev->irq);
1381 pd->software_irq_signal = false;
1381 1382
1382 spin_lock_irqsave(&pd->int_lock, flags); 1383 spin_lock_irqsave(&pd->int_lock, flags);
1383 /* configure interrupt deassertion timer and enable interrupts */ 1384 /* configure interrupt deassertion timer and enable interrupts */
@@ -1393,8 +1394,6 @@ static int smsc9420_open(struct net_device *dev)
1393 smsc9420_pci_flush_write(pd); 1394 smsc9420_pci_flush_write(pd);
1394 1395
1395 timeout = 1000; 1396 timeout = 1000;
1396 pd->software_irq_signal = false;
1397 smp_wmb();
1398 while (timeout--) { 1397 while (timeout--) {
1399 if (pd->software_irq_signal) 1398 if (pd->software_irq_signal)
1400 break; 1399 break;
diff --git a/drivers/net/tulip/21142.c b/drivers/net/tulip/21142.c
index 1210fb3748a..db7d5e11855 100644
--- a/drivers/net/tulip/21142.c
+++ b/drivers/net/tulip/21142.c
@@ -9,6 +9,11 @@
9 9
10 Please refer to Documentation/DocBook/tulip-user.{pdf,ps,html} 10 Please refer to Documentation/DocBook/tulip-user.{pdf,ps,html}
11 for more information on this driver. 11 for more information on this driver.
12
13 DC21143 manual "21143 PCI/CardBus 10/100Mb/s Ethernet LAN Controller
14 Hardware Reference Manual" is currently available at :
15 http://developer.intel.com/design/network/manuals/278074.htm
16
12 Please submit bugs to http://bugzilla.kernel.org/ . 17 Please submit bugs to http://bugzilla.kernel.org/ .
13*/ 18*/
14 19
@@ -32,7 +37,11 @@ void t21142_media_task(struct work_struct *work)
32 int csr12 = ioread32(ioaddr + CSR12); 37 int csr12 = ioread32(ioaddr + CSR12);
33 int next_tick = 60*HZ; 38 int next_tick = 60*HZ;
34 int new_csr6 = 0; 39 int new_csr6 = 0;
40 int csr14 = ioread32(ioaddr + CSR14);
35 41
42 /* CSR12[LS10,LS100] are not reliable during autonegotiation */
43 if ((csr14 & 0x80) && (csr12 & 0x7000) != 0x5000)
44 csr12 |= 6;
36 if (tulip_debug > 2) 45 if (tulip_debug > 2)
37 printk(KERN_INFO"%s: 21143 negotiation status %8.8x, %s.\n", 46 printk(KERN_INFO"%s: 21143 negotiation status %8.8x, %s.\n",
38 dev->name, csr12, medianame[dev->if_port]); 47 dev->name, csr12, medianame[dev->if_port]);
@@ -76,7 +85,7 @@ void t21142_media_task(struct work_struct *work)
76 new_csr6 = 0x83860000; 85 new_csr6 = 0x83860000;
77 dev->if_port = 3; 86 dev->if_port = 3;
78 iowrite32(0, ioaddr + CSR13); 87 iowrite32(0, ioaddr + CSR13);
79 iowrite32(0x0003FF7F, ioaddr + CSR14); 88 iowrite32(0x0003FFFF, ioaddr + CSR14);
80 iowrite16(8, ioaddr + CSR15); 89 iowrite16(8, ioaddr + CSR15);
81 iowrite32(1, ioaddr + CSR13); 90 iowrite32(1, ioaddr + CSR13);
82 } 91 }
@@ -132,10 +141,14 @@ void t21142_lnk_change(struct net_device *dev, int csr5)
132 struct tulip_private *tp = netdev_priv(dev); 141 struct tulip_private *tp = netdev_priv(dev);
133 void __iomem *ioaddr = tp->base_addr; 142 void __iomem *ioaddr = tp->base_addr;
134 int csr12 = ioread32(ioaddr + CSR12); 143 int csr12 = ioread32(ioaddr + CSR12);
144 int csr14 = ioread32(ioaddr + CSR14);
135 145
146 /* CSR12[LS10,LS100] are not reliable during autonegotiation */
147 if ((csr14 & 0x80) && (csr12 & 0x7000) != 0x5000)
148 csr12 |= 6;
136 if (tulip_debug > 1) 149 if (tulip_debug > 1)
137 printk(KERN_INFO"%s: 21143 link status interrupt %8.8x, CSR5 %x, " 150 printk(KERN_INFO"%s: 21143 link status interrupt %8.8x, CSR5 %x, "
138 "%8.8x.\n", dev->name, csr12, csr5, ioread32(ioaddr + CSR14)); 151 "%8.8x.\n", dev->name, csr12, csr5, csr14);
139 152
140 /* If NWay finished and we have a negotiated partner capability. */ 153 /* If NWay finished and we have a negotiated partner capability. */
141 if (tp->nway && !tp->nwayset && (csr12 & 0x7000) == 0x5000) { 154 if (tp->nway && !tp->nwayset && (csr12 & 0x7000) == 0x5000) {
@@ -143,7 +156,9 @@ void t21142_lnk_change(struct net_device *dev, int csr5)
143 int negotiated = tp->sym_advertise & (csr12 >> 16); 156 int negotiated = tp->sym_advertise & (csr12 >> 16);
144 tp->lpar = csr12 >> 16; 157 tp->lpar = csr12 >> 16;
145 tp->nwayset = 1; 158 tp->nwayset = 1;
146 if (negotiated & 0x0100) dev->if_port = 5; 159 /* If partner cannot negotiate, it is 10Mbps Half Duplex */
160 if (!(csr12 & 0x8000)) dev->if_port = 0;
161 else if (negotiated & 0x0100) dev->if_port = 5;
147 else if (negotiated & 0x0080) dev->if_port = 3; 162 else if (negotiated & 0x0080) dev->if_port = 3;
148 else if (negotiated & 0x0040) dev->if_port = 4; 163 else if (negotiated & 0x0040) dev->if_port = 4;
149 else if (negotiated & 0x0020) dev->if_port = 0; 164 else if (negotiated & 0x0020) dev->if_port = 0;
@@ -214,7 +229,7 @@ void t21142_lnk_change(struct net_device *dev, int csr5)
214 tp->timer.expires = RUN_AT(3*HZ); 229 tp->timer.expires = RUN_AT(3*HZ);
215 add_timer(&tp->timer); 230 add_timer(&tp->timer);
216 } else if (dev->if_port == 5) 231 } else if (dev->if_port == 5)
217 iowrite32(ioread32(ioaddr + CSR14) & ~0x080, ioaddr + CSR14); 232 iowrite32(csr14 & ~0x080, ioaddr + CSR14);
218 } else if (dev->if_port == 0 || dev->if_port == 4) { 233 } else if (dev->if_port == 0 || dev->if_port == 4) {
219 if ((csr12 & 4) == 0) 234 if ((csr12 & 4) == 0)
220 printk(KERN_INFO"%s: 21143 10baseT link beat good.\n", 235 printk(KERN_INFO"%s: 21143 10baseT link beat good.\n",
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index 11441225bf4..e87986867ba 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -1536,6 +1536,11 @@ static void adjust_link(struct net_device *dev)
1536static int init_phy(struct net_device *dev) 1536static int init_phy(struct net_device *dev)
1537{ 1537{
1538 struct ucc_geth_private *priv = netdev_priv(dev); 1538 struct ucc_geth_private *priv = netdev_priv(dev);
1539 struct device_node *np = priv->node;
1540 struct device_node *phy, *mdio;
1541 const phandle *ph;
1542 char bus_name[MII_BUS_ID_SIZE];
1543 const unsigned int *id;
1539 struct phy_device *phydev; 1544 struct phy_device *phydev;
1540 char phy_id[BUS_ID_SIZE]; 1545 char phy_id[BUS_ID_SIZE];
1541 1546
@@ -1543,8 +1548,18 @@ static int init_phy(struct net_device *dev)
1543 priv->oldspeed = 0; 1548 priv->oldspeed = 0;
1544 priv->oldduplex = -1; 1549 priv->oldduplex = -1;
1545 1550
1546 snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT, priv->ug_info->mdio_bus, 1551 ph = of_get_property(np, "phy-handle", NULL);
1547 priv->ug_info->phy_address); 1552 phy = of_find_node_by_phandle(*ph);
1553 mdio = of_get_parent(phy);
1554
1555 id = of_get_property(phy, "reg", NULL);
1556
1557 of_node_put(phy);
1558 of_node_put(mdio);
1559
1560 uec_mdio_bus_name(bus_name, mdio);
1561 snprintf(phy_id, sizeof(phy_id), "%s:%02x",
1562 bus_name, *id);
1548 1563
1549 phydev = phy_connect(dev, phy_id, &adjust_link, 0, priv->phy_interface); 1564 phydev = phy_connect(dev, phy_id, &adjust_link, 0, priv->phy_interface);
1550 1565
@@ -3748,6 +3763,7 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
3748 3763
3749 ugeth->ug_info = ug_info; 3764 ugeth->ug_info = ug_info;
3750 ugeth->dev = dev; 3765 ugeth->dev = dev;
3766 ugeth->node = np;
3751 3767
3752 return 0; 3768 return 0;
3753} 3769}
diff --git a/drivers/net/ucc_geth.h b/drivers/net/ucc_geth.h
index 8f699cb773e..16cbe42ba43 100644
--- a/drivers/net/ucc_geth.h
+++ b/drivers/net/ucc_geth.h
@@ -1186,6 +1186,8 @@ struct ucc_geth_private {
1186 int oldspeed; 1186 int oldspeed;
1187 int oldduplex; 1187 int oldduplex;
1188 int oldlink; 1188 int oldlink;
1189
1190 struct device_node *node;
1189}; 1191};
1190 1192
1191void uec_set_ethtool_ops(struct net_device *netdev); 1193void uec_set_ethtool_ops(struct net_device *netdev);
diff --git a/drivers/net/ucc_geth_mii.c b/drivers/net/ucc_geth_mii.c
index c001d261366..54635911305 100644
--- a/drivers/net/ucc_geth_mii.c
+++ b/drivers/net/ucc_geth_mii.c
@@ -156,7 +156,7 @@ static int uec_mdio_probe(struct of_device *ofdev, const struct of_device_id *ma
156 if (err) 156 if (err)
157 goto reg_map_fail; 157 goto reg_map_fail;
158 158
159 snprintf(new_bus->id, MII_BUS_ID_SIZE, "%x", res.start); 159 uec_mdio_bus_name(new_bus->id, np);
160 160
161 new_bus->irq = kmalloc(32 * sizeof(int), GFP_KERNEL); 161 new_bus->irq = kmalloc(32 * sizeof(int), GFP_KERNEL);
162 162
@@ -283,3 +283,13 @@ void uec_mdio_exit(void)
283{ 283{
284 of_unregister_platform_driver(&uec_mdio_driver); 284 of_unregister_platform_driver(&uec_mdio_driver);
285} 285}
286
287void uec_mdio_bus_name(char *name, struct device_node *np)
288{
289 const u32 *reg;
290
291 reg = of_get_property(np, "reg", NULL);
292
293 snprintf(name, MII_BUS_ID_SIZE, "%s@%x", np->name, reg ? *reg : 0);
294}
295
diff --git a/drivers/net/ucc_geth_mii.h b/drivers/net/ucc_geth_mii.h
index 1e45b2028a5..840cf80235b 100644
--- a/drivers/net/ucc_geth_mii.h
+++ b/drivers/net/ucc_geth_mii.h
@@ -97,4 +97,5 @@ int uec_mdio_read(struct mii_bus *bus, int mii_id, int regnum);
97int uec_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value); 97int uec_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value);
98int __init uec_mdio_init(void); 98int __init uec_mdio_init(void);
99void uec_mdio_exit(void); 99void uec_mdio_exit(void);
100void uec_mdio_bus_name(char *name, struct device_node *np);
100#endif /* __UEC_MII_H */ 101#endif /* __UEC_MII_H */
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 63ef2a8905f..c68808336c8 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -287,7 +287,7 @@ static void try_fill_recv_maxbufs(struct virtnet_info *vi)
287 skb_put(skb, MAX_PACKET_LEN); 287 skb_put(skb, MAX_PACKET_LEN);
288 288
289 hdr = skb_vnet_hdr(skb); 289 hdr = skb_vnet_hdr(skb);
290 sg_init_one(sg, hdr, sizeof(*hdr)); 290 sg_set_buf(sg, hdr, sizeof(*hdr));
291 291
292 if (vi->big_packets) { 292 if (vi->big_packets) {
293 for (i = 0; i < MAX_SKB_FRAGS; i++) { 293 for (i = 0; i < MAX_SKB_FRAGS; i++) {
@@ -488,9 +488,9 @@ static int xmit_skb(struct virtnet_info *vi, struct sk_buff *skb)
488 488
489 /* Encode metadata header at front. */ 489 /* Encode metadata header at front. */
490 if (vi->mergeable_rx_bufs) 490 if (vi->mergeable_rx_bufs)
491 sg_init_one(sg, mhdr, sizeof(*mhdr)); 491 sg_set_buf(sg, mhdr, sizeof(*mhdr));
492 else 492 else
493 sg_init_one(sg, hdr, sizeof(*hdr)); 493 sg_set_buf(sg, hdr, sizeof(*hdr));
494 494
495 num = skb_to_sgvec(skb, sg+1, 0, skb->len) + 1; 495 num = skb_to_sgvec(skb, sg+1, 0, skb->len) + 1;
496 496
diff --git a/drivers/net/wimax/i2400m/debugfs.c b/drivers/net/wimax/i2400m/debugfs.c
index 62663298597..9b81af3f80a 100644
--- a/drivers/net/wimax/i2400m/debugfs.c
+++ b/drivers/net/wimax/i2400m/debugfs.c
@@ -234,20 +234,6 @@ struct dentry *debugfs_create_i2400m_reset(
234 &fops_i2400m_reset); 234 &fops_i2400m_reset);
235} 235}
236 236
237/*
238 * Debug levels control; see debug.h
239 */
240struct d_level D_LEVEL[] = {
241 D_SUBMODULE_DEFINE(control),
242 D_SUBMODULE_DEFINE(driver),
243 D_SUBMODULE_DEFINE(debugfs),
244 D_SUBMODULE_DEFINE(fw),
245 D_SUBMODULE_DEFINE(netdev),
246 D_SUBMODULE_DEFINE(rfkill),
247 D_SUBMODULE_DEFINE(rx),
248 D_SUBMODULE_DEFINE(tx),
249};
250size_t D_LEVEL_SIZE = ARRAY_SIZE(D_LEVEL);
251 237
252#define __debugfs_register(prefix, name, parent) \ 238#define __debugfs_register(prefix, name, parent) \
253do { \ 239do { \
diff --git a/drivers/net/wimax/i2400m/driver.c b/drivers/net/wimax/i2400m/driver.c
index 5f98047e18c..e80a0b65a75 100644
--- a/drivers/net/wimax/i2400m/driver.c
+++ b/drivers/net/wimax/i2400m/driver.c
@@ -707,6 +707,22 @@ void i2400m_release(struct i2400m *i2400m)
707EXPORT_SYMBOL_GPL(i2400m_release); 707EXPORT_SYMBOL_GPL(i2400m_release);
708 708
709 709
710/*
711 * Debug levels control; see debug.h
712 */
713struct d_level D_LEVEL[] = {
714 D_SUBMODULE_DEFINE(control),
715 D_SUBMODULE_DEFINE(driver),
716 D_SUBMODULE_DEFINE(debugfs),
717 D_SUBMODULE_DEFINE(fw),
718 D_SUBMODULE_DEFINE(netdev),
719 D_SUBMODULE_DEFINE(rfkill),
720 D_SUBMODULE_DEFINE(rx),
721 D_SUBMODULE_DEFINE(tx),
722};
723size_t D_LEVEL_SIZE = ARRAY_SIZE(D_LEVEL);
724
725
710static 726static
711int __init i2400m_driver_init(void) 727int __init i2400m_driver_init(void)
712{ 728{
diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c
index 8ef87356e08..a533ed60bb4 100644
--- a/drivers/net/wireless/ath5k/base.c
+++ b/drivers/net/wireless/ath5k/base.c
@@ -1028,6 +1028,8 @@ ath5k_setup_bands(struct ieee80211_hw *hw)
1028 * it's done by reseting the chip. To accomplish this we must 1028 * it's done by reseting the chip. To accomplish this we must
1029 * first cleanup any pending DMA, then restart stuff after a la 1029 * first cleanup any pending DMA, then restart stuff after a la
1030 * ath5k_init. 1030 * ath5k_init.
1031 *
1032 * Called with sc->lock.
1031 */ 1033 */
1032static int 1034static int
1033ath5k_chan_set(struct ath5k_softc *sc, struct ieee80211_channel *chan) 1035ath5k_chan_set(struct ath5k_softc *sc, struct ieee80211_channel *chan)
@@ -2814,11 +2816,17 @@ ath5k_config(struct ieee80211_hw *hw, u32 changed)
2814{ 2816{
2815 struct ath5k_softc *sc = hw->priv; 2817 struct ath5k_softc *sc = hw->priv;
2816 struct ieee80211_conf *conf = &hw->conf; 2818 struct ieee80211_conf *conf = &hw->conf;
2819 int ret;
2820
2821 mutex_lock(&sc->lock);
2817 2822
2818 sc->bintval = conf->beacon_int; 2823 sc->bintval = conf->beacon_int;
2819 sc->power_level = conf->power_level; 2824 sc->power_level = conf->power_level;
2820 2825
2821 return ath5k_chan_set(sc, conf->channel); 2826 ret = ath5k_chan_set(sc, conf->channel);
2827
2828 mutex_unlock(&sc->lock);
2829 return ret;
2822} 2830}
2823 2831
2824static int 2832static int
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 0dc8eed1640..b35c8813bef 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -1719,6 +1719,10 @@ static int iwl_read_ucode(struct iwl_priv *priv)
1719 priv->ucode_data_backup.len = data_size; 1719 priv->ucode_data_backup.len = data_size;
1720 iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_data_backup); 1720 iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_data_backup);
1721 1721
1722 if (!priv->ucode_code.v_addr || !priv->ucode_data.v_addr ||
1723 !priv->ucode_data_backup.v_addr)
1724 goto err_pci_alloc;
1725
1722 /* Initialization instructions and data */ 1726 /* Initialization instructions and data */
1723 if (init_size && init_data_size) { 1727 if (init_size && init_data_size) {
1724 priv->ucode_init.len = init_size; 1728 priv->ucode_init.len = init_size;
diff --git a/drivers/net/wireless/rtl818x/rtl8187_rtl8225.c b/drivers/net/wireless/rtl818x/rtl8187_rtl8225.c
index 4e75e8e7fa9..78df281b297 100644
--- a/drivers/net/wireless/rtl818x/rtl8187_rtl8225.c
+++ b/drivers/net/wireless/rtl818x/rtl8187_rtl8225.c
@@ -285,7 +285,10 @@ static void rtl8225_rf_set_tx_power(struct ieee80211_hw *dev, int channel)
285 ofdm_power = priv->channels[channel - 1].hw_value >> 4; 285 ofdm_power = priv->channels[channel - 1].hw_value >> 4;
286 286
287 cck_power = min(cck_power, (u8)11); 287 cck_power = min(cck_power, (u8)11);
288 ofdm_power = min(ofdm_power, (u8)35); 288 if (ofdm_power > (u8)15)
289 ofdm_power = 25;
290 else
291 ofdm_power += 10;
289 292
290 rtl818x_iowrite8(priv, &priv->map->TX_GAIN_CCK, 293 rtl818x_iowrite8(priv, &priv->map->TX_GAIN_CCK,
291 rtl8225_tx_gain_cck_ofdm[cck_power / 6] >> 1); 294 rtl8225_tx_gain_cck_ofdm[cck_power / 6] >> 1);
@@ -536,7 +539,10 @@ static void rtl8225z2_rf_set_tx_power(struct ieee80211_hw *dev, int channel)
536 cck_power += priv->txpwr_base & 0xF; 539 cck_power += priv->txpwr_base & 0xF;
537 cck_power = min(cck_power, (u8)35); 540 cck_power = min(cck_power, (u8)35);
538 541
539 ofdm_power = min(ofdm_power, (u8)15); 542 if (ofdm_power > (u8)15)
543 ofdm_power = 25;
544 else
545 ofdm_power += 10;
540 ofdm_power += priv->txpwr_base >> 4; 546 ofdm_power += priv->txpwr_base >> 4;
541 ofdm_power = min(ofdm_power, (u8)35); 547 ofdm_power = min(ofdm_power, (u8)35);
542 548
diff --git a/drivers/serial/jsm/jsm_tty.c b/drivers/serial/jsm/jsm_tty.c
index 3547558d2ca..324c74d2f66 100644
--- a/drivers/serial/jsm/jsm_tty.c
+++ b/drivers/serial/jsm/jsm_tty.c
@@ -161,6 +161,11 @@ static void jsm_tty_stop_rx(struct uart_port *port)
161 channel->ch_bd->bd_ops->disable_receiver(channel); 161 channel->ch_bd->bd_ops->disable_receiver(channel);
162} 162}
163 163
164static void jsm_tty_enable_ms(struct uart_port *port)
165{
166 /* Nothing needed */
167}
168
164static void jsm_tty_break(struct uart_port *port, int break_state) 169static void jsm_tty_break(struct uart_port *port, int break_state)
165{ 170{
166 unsigned long lock_flags; 171 unsigned long lock_flags;
@@ -345,6 +350,7 @@ static struct uart_ops jsm_ops = {
345 .start_tx = jsm_tty_start_tx, 350 .start_tx = jsm_tty_start_tx,
346 .send_xchar = jsm_tty_send_xchar, 351 .send_xchar = jsm_tty_send_xchar,
347 .stop_rx = jsm_tty_stop_rx, 352 .stop_rx = jsm_tty_stop_rx,
353 .enable_ms = jsm_tty_enable_ms,
348 .break_ctl = jsm_tty_break, 354 .break_ctl = jsm_tty_break,
349 .startup = jsm_tty_open, 355 .startup = jsm_tty_open,
350 .shutdown = jsm_tty_close, 356 .shutdown = jsm_tty_close,
diff --git a/fs/bio-integrity.c b/fs/bio-integrity.c
index 77ebc3c263d..549b0144da1 100644
--- a/fs/bio-integrity.c
+++ b/fs/bio-integrity.c
@@ -140,7 +140,6 @@ int bio_integrity_add_page(struct bio *bio, struct page *page,
140 140
141 iv = bip_vec_idx(bip, bip->bip_vcnt); 141 iv = bip_vec_idx(bip, bip->bip_vcnt);
142 BUG_ON(iv == NULL); 142 BUG_ON(iv == NULL);
143 BUG_ON(iv->bv_page != NULL);
144 143
145 iv->bv_page = page; 144 iv->bv_page = page;
146 iv->bv_len = len; 145 iv->bv_len = len;
@@ -465,7 +464,7 @@ static int bio_integrity_verify(struct bio *bio)
465 464
466 if (ret) { 465 if (ret) {
467 kunmap_atomic(kaddr, KM_USER0); 466 kunmap_atomic(kaddr, KM_USER0);
468 break; 467 return ret;
469 } 468 }
470 469
471 sectors = bv->bv_len / bi->sector_size; 470 sectors = bv->bv_len / bi->sector_size;
@@ -493,18 +492,13 @@ static void bio_integrity_verify_fn(struct work_struct *work)
493 struct bio_integrity_payload *bip = 492 struct bio_integrity_payload *bip =
494 container_of(work, struct bio_integrity_payload, bip_work); 493 container_of(work, struct bio_integrity_payload, bip_work);
495 struct bio *bio = bip->bip_bio; 494 struct bio *bio = bip->bip_bio;
496 int error = bip->bip_error; 495 int error;
497 496
498 if (bio_integrity_verify(bio)) { 497 error = bio_integrity_verify(bio);
499 clear_bit(BIO_UPTODATE, &bio->bi_flags);
500 error = -EIO;
501 }
502 498
503 /* Restore original bio completion handler */ 499 /* Restore original bio completion handler */
504 bio->bi_end_io = bip->bip_end_io; 500 bio->bi_end_io = bip->bip_end_io;
505 501 bio_endio(bio, error);
506 if (bio->bi_end_io)
507 bio->bi_end_io(bio, error);
508} 502}
509 503
510/** 504/**
@@ -525,7 +519,17 @@ void bio_integrity_endio(struct bio *bio, int error)
525 519
526 BUG_ON(bip->bip_bio != bio); 520 BUG_ON(bip->bip_bio != bio);
527 521
528 bip->bip_error = error; 522 /* In case of an I/O error there is no point in verifying the
523 * integrity metadata. Restore original bio end_io handler
524 * and run it.
525 */
526 if (error) {
527 bio->bi_end_io = bip->bip_end_io;
528 bio_endio(bio, error);
529
530 return;
531 }
532
529 INIT_WORK(&bip->bip_work, bio_integrity_verify_fn); 533 INIT_WORK(&bip->bip_work, bio_integrity_verify_fn);
530 queue_work(kintegrityd_wq, &bip->bip_work); 534 queue_work(kintegrityd_wq, &bip->bip_work);
531} 535}
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
index 5235c67e759..c8f8d5904f5 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -538,6 +538,7 @@ static int dev_ifsioc(unsigned int fd, unsigned int cmd, unsigned long arg)
538 * cannot be fixed without breaking all existing apps. 538 * cannot be fixed without breaking all existing apps.
539 */ 539 */
540 case TUNSETIFF: 540 case TUNSETIFF:
541 case TUNGETIFF:
541 case SIOCGIFFLAGS: 542 case SIOCGIFFLAGS:
542 case SIOCGIFMETRIC: 543 case SIOCGIFMETRIC:
543 case SIOCGIFMTU: 544 case SIOCGIFMTU:
@@ -1982,6 +1983,11 @@ COMPATIBLE_IOCTL(TUNSETNOCSUM)
1982COMPATIBLE_IOCTL(TUNSETDEBUG) 1983COMPATIBLE_IOCTL(TUNSETDEBUG)
1983COMPATIBLE_IOCTL(TUNSETPERSIST) 1984COMPATIBLE_IOCTL(TUNSETPERSIST)
1984COMPATIBLE_IOCTL(TUNSETOWNER) 1985COMPATIBLE_IOCTL(TUNSETOWNER)
1986COMPATIBLE_IOCTL(TUNSETLINK)
1987COMPATIBLE_IOCTL(TUNSETGROUP)
1988COMPATIBLE_IOCTL(TUNGETFEATURES)
1989COMPATIBLE_IOCTL(TUNSETOFFLOAD)
1990COMPATIBLE_IOCTL(TUNSETTXFILTER)
1985/* Big V */ 1991/* Big V */
1986COMPATIBLE_IOCTL(VT_SETMODE) 1992COMPATIBLE_IOCTL(VT_SETMODE)
1987COMPATIBLE_IOCTL(VT_GETMODE) 1993COMPATIBLE_IOCTL(VT_GETMODE)
@@ -2573,6 +2579,7 @@ HANDLE_IOCTL(SIOCGIFPFLAGS, dev_ifsioc)
2573HANDLE_IOCTL(SIOCGIFTXQLEN, dev_ifsioc) 2579HANDLE_IOCTL(SIOCGIFTXQLEN, dev_ifsioc)
2574HANDLE_IOCTL(SIOCSIFTXQLEN, dev_ifsioc) 2580HANDLE_IOCTL(SIOCSIFTXQLEN, dev_ifsioc)
2575HANDLE_IOCTL(TUNSETIFF, dev_ifsioc) 2581HANDLE_IOCTL(TUNSETIFF, dev_ifsioc)
2582HANDLE_IOCTL(TUNGETIFF, dev_ifsioc)
2576HANDLE_IOCTL(SIOCETHTOOL, ethtool_ioctl) 2583HANDLE_IOCTL(SIOCETHTOOL, ethtool_ioctl)
2577HANDLE_IOCTL(SIOCBONDENSLAVE, bond_ioctl) 2584HANDLE_IOCTL(SIOCBONDENSLAVE, bond_ioctl)
2578HANDLE_IOCTL(SIOCBONDRELEASE, bond_ioctl) 2585HANDLE_IOCTL(SIOCBONDRELEASE, bond_ioctl)
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c
index 69a3d19ca9f..4db4ffa1eda 100644
--- a/fs/ext3/namei.c
+++ b/fs/ext3/namei.c
@@ -1358,7 +1358,7 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry,
1358 struct fake_dirent *fde; 1358 struct fake_dirent *fde;
1359 1359
1360 blocksize = dir->i_sb->s_blocksize; 1360 blocksize = dir->i_sb->s_blocksize;
1361 dxtrace(printk("Creating index\n")); 1361 dxtrace(printk(KERN_DEBUG "Creating index: inode %lu\n", dir->i_ino));
1362 retval = ext3_journal_get_write_access(handle, bh); 1362 retval = ext3_journal_get_write_access(handle, bh);
1363 if (retval) { 1363 if (retval) {
1364 ext3_std_error(dir->i_sb, retval); 1364 ext3_std_error(dir->i_sb, retval);
@@ -1367,6 +1367,19 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry,
1367 } 1367 }
1368 root = (struct dx_root *) bh->b_data; 1368 root = (struct dx_root *) bh->b_data;
1369 1369
1370 /* The 0th block becomes the root, move the dirents out */
1371 fde = &root->dotdot;
1372 de = (struct ext3_dir_entry_2 *)((char *)fde +
1373 ext3_rec_len_from_disk(fde->rec_len));
1374 if ((char *) de >= (((char *) root) + blocksize)) {
1375 ext3_error(dir->i_sb, __func__,
1376 "invalid rec_len for '..' in inode %lu",
1377 dir->i_ino);
1378 brelse(bh);
1379 return -EIO;
1380 }
1381 len = ((char *) root) + blocksize - (char *) de;
1382
1370 bh2 = ext3_append (handle, dir, &block, &retval); 1383 bh2 = ext3_append (handle, dir, &block, &retval);
1371 if (!(bh2)) { 1384 if (!(bh2)) {
1372 brelse(bh); 1385 brelse(bh);
@@ -1375,11 +1388,6 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry,
1375 EXT3_I(dir)->i_flags |= EXT3_INDEX_FL; 1388 EXT3_I(dir)->i_flags |= EXT3_INDEX_FL;
1376 data1 = bh2->b_data; 1389 data1 = bh2->b_data;
1377 1390
1378 /* The 0th block becomes the root, move the dirents out */
1379 fde = &root->dotdot;
1380 de = (struct ext3_dir_entry_2 *)((char *)fde +
1381 ext3_rec_len_from_disk(fde->rec_len));
1382 len = ((char *) root) + blocksize - (char *) de;
1383 memcpy (data1, de, len); 1391 memcpy (data1, de, len);
1384 de = (struct ext3_dir_entry_2 *) data1; 1392 de = (struct ext3_dir_entry_2 *) data1;
1385 top = data1 + len; 1393 top = data1 + len;
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
index 6bba06b09dd..9a50b8052dc 100644
--- a/fs/ext4/balloc.c
+++ b/fs/ext4/balloc.c
@@ -684,15 +684,15 @@ ext4_fsblk_t ext4_count_free_blocks(struct super_block *sb)
684 gdp = ext4_get_group_desc(sb, i, NULL); 684 gdp = ext4_get_group_desc(sb, i, NULL);
685 if (!gdp) 685 if (!gdp)
686 continue; 686 continue;
687 desc_count += le16_to_cpu(gdp->bg_free_blocks_count); 687 desc_count += ext4_free_blks_count(sb, gdp);
688 brelse(bitmap_bh); 688 brelse(bitmap_bh);
689 bitmap_bh = ext4_read_block_bitmap(sb, i); 689 bitmap_bh = ext4_read_block_bitmap(sb, i);
690 if (bitmap_bh == NULL) 690 if (bitmap_bh == NULL)
691 continue; 691 continue;
692 692
693 x = ext4_count_free(bitmap_bh, sb->s_blocksize); 693 x = ext4_count_free(bitmap_bh, sb->s_blocksize);
694 printk(KERN_DEBUG "group %lu: stored = %d, counted = %u\n", 694 printk(KERN_DEBUG "group %u: stored = %d, counted = %u\n",
695 i, le16_to_cpu(gdp->bg_free_blocks_count), x); 695 i, ext4_free_blks_count(sb, gdp), x);
696 bitmap_count += x; 696 bitmap_count += x;
697 } 697 }
698 brelse(bitmap_bh); 698 brelse(bitmap_bh);
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index c668e4377d7..aafc9eba1c2 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -1206,8 +1206,11 @@ static inline void ext4_r_blocks_count_set(struct ext4_super_block *es,
1206 1206
1207static inline loff_t ext4_isize(struct ext4_inode *raw_inode) 1207static inline loff_t ext4_isize(struct ext4_inode *raw_inode)
1208{ 1208{
1209 return ((loff_t)le32_to_cpu(raw_inode->i_size_high) << 32) | 1209 if (S_ISREG(le16_to_cpu(raw_inode->i_mode)))
1210 le32_to_cpu(raw_inode->i_size_lo); 1210 return ((loff_t)le32_to_cpu(raw_inode->i_size_high) << 32) |
1211 le32_to_cpu(raw_inode->i_size_lo);
1212 else
1213 return (loff_t) le32_to_cpu(raw_inode->i_size_lo);
1211} 1214}
1212 1215
1213static inline void ext4_isize_set(struct ext4_inode *raw_inode, loff_t i_size) 1216static inline void ext4_isize_set(struct ext4_inode *raw_inode, loff_t i_size)
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 54bf0623a9a..e2eab196875 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -3048,7 +3048,7 @@ retry:
3048 WARN_ON(ret <= 0); 3048 WARN_ON(ret <= 0);
3049 printk(KERN_ERR "%s: ext4_ext_get_blocks " 3049 printk(KERN_ERR "%s: ext4_ext_get_blocks "
3050 "returned error inode#%lu, block=%u, " 3050 "returned error inode#%lu, block=%u, "
3051 "max_blocks=%lu", __func__, 3051 "max_blocks=%u", __func__,
3052 inode->i_ino, block, max_blocks); 3052 inode->i_ino, block, max_blocks);
3053#endif 3053#endif
3054 ext4_mark_inode_dirty(handle, inode); 3054 ext4_mark_inode_dirty(handle, inode);
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index a6444cee0c7..03ba20be132 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -360,9 +360,9 @@ static int ext4_block_to_path(struct inode *inode,
360 final = ptrs; 360 final = ptrs;
361 } else { 361 } else {
362 ext4_warning(inode->i_sb, "ext4_block_to_path", 362 ext4_warning(inode->i_sb, "ext4_block_to_path",
363 "block %lu > max", 363 "block %lu > max in inode %lu",
364 i_block + direct_blocks + 364 i_block + direct_blocks +
365 indirect_blocks + double_blocks); 365 indirect_blocks + double_blocks, inode->i_ino);
366 } 366 }
367 if (boundary) 367 if (boundary)
368 *boundary = final - 1 - (i_block & (ptrs - 1)); 368 *boundary = final - 1 - (i_block & (ptrs - 1));
@@ -2821,9 +2821,6 @@ static sector_t ext4_bmap(struct address_space *mapping, sector_t block)
2821 filemap_write_and_wait(mapping); 2821 filemap_write_and_wait(mapping);
2822 } 2822 }
2823 2823
2824 BUG_ON(!EXT4_JOURNAL(inode) &&
2825 EXT4_I(inode)->i_state & EXT4_STATE_JDATA);
2826
2827 if (EXT4_JOURNAL(inode) && EXT4_I(inode)->i_state & EXT4_STATE_JDATA) { 2824 if (EXT4_JOURNAL(inode) && EXT4_I(inode)->i_state & EXT4_STATE_JDATA) {
2828 /* 2825 /*
2829 * This is a REALLY heavyweight approach, but the use of 2826 * This is a REALLY heavyweight approach, but the use of
@@ -3622,7 +3619,7 @@ static void ext4_free_data(handle_t *handle, struct inode *inode,
3622 * block pointed to itself, it would have been detached when 3619 * block pointed to itself, it would have been detached when
3623 * the block was cleared. Check for this instead of OOPSing. 3620 * the block was cleared. Check for this instead of OOPSing.
3624 */ 3621 */
3625 if (bh2jh(this_bh)) 3622 if ((EXT4_JOURNAL(inode) == NULL) || bh2jh(this_bh))
3626 ext4_handle_dirty_metadata(handle, inode, this_bh); 3623 ext4_handle_dirty_metadata(handle, inode, this_bh);
3627 else 3624 else
3628 ext4_error(inode->i_sb, __func__, 3625 ext4_error(inode->i_sb, __func__,
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 918aec0c8a1..deba54f6cbe 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -3025,7 +3025,7 @@ ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac,
3025 goto out_err; 3025 goto out_err;
3026 3026
3027 ext4_debug("using block group %u(%d)\n", ac->ac_b_ex.fe_group, 3027 ext4_debug("using block group %u(%d)\n", ac->ac_b_ex.fe_group,
3028 gdp->bg_free_blocks_count); 3028 ext4_free_blks_count(sb, gdp));
3029 3029
3030 err = ext4_journal_get_write_access(handle, gdp_bh); 3030 err = ext4_journal_get_write_access(handle, gdp_bh);
3031 if (err) 3031 if (err)
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index fec0b4c2f5f..ba702bd7910 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -1368,7 +1368,7 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry,
1368 struct fake_dirent *fde; 1368 struct fake_dirent *fde;
1369 1369
1370 blocksize = dir->i_sb->s_blocksize; 1370 blocksize = dir->i_sb->s_blocksize;
1371 dxtrace(printk(KERN_DEBUG "Creating index\n")); 1371 dxtrace(printk(KERN_DEBUG "Creating index: inode %lu\n", dir->i_ino));
1372 retval = ext4_journal_get_write_access(handle, bh); 1372 retval = ext4_journal_get_write_access(handle, bh);
1373 if (retval) { 1373 if (retval) {
1374 ext4_std_error(dir->i_sb, retval); 1374 ext4_std_error(dir->i_sb, retval);
@@ -1377,6 +1377,20 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry,
1377 } 1377 }
1378 root = (struct dx_root *) bh->b_data; 1378 root = (struct dx_root *) bh->b_data;
1379 1379
1380 /* The 0th block becomes the root, move the dirents out */
1381 fde = &root->dotdot;
1382 de = (struct ext4_dir_entry_2 *)((char *)fde +
1383 ext4_rec_len_from_disk(fde->rec_len));
1384 if ((char *) de >= (((char *) root) + blocksize)) {
1385 ext4_error(dir->i_sb, __func__,
1386 "invalid rec_len for '..' in inode %lu",
1387 dir->i_ino);
1388 brelse(bh);
1389 return -EIO;
1390 }
1391 len = ((char *) root) + blocksize - (char *) de;
1392
1393 /* Allocate new block for the 0th block's dirents */
1380 bh2 = ext4_append(handle, dir, &block, &retval); 1394 bh2 = ext4_append(handle, dir, &block, &retval);
1381 if (!(bh2)) { 1395 if (!(bh2)) {
1382 brelse(bh); 1396 brelse(bh);
@@ -1385,11 +1399,6 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry,
1385 EXT4_I(dir)->i_flags |= EXT4_INDEX_FL; 1399 EXT4_I(dir)->i_flags |= EXT4_INDEX_FL;
1386 data1 = bh2->b_data; 1400 data1 = bh2->b_data;
1387 1401
1388 /* The 0th block becomes the root, move the dirents out */
1389 fde = &root->dotdot;
1390 de = (struct ext4_dir_entry_2 *)((char *)fde +
1391 ext4_rec_len_from_disk(fde->rec_len));
1392 len = ((char *) root) + blocksize - (char *) de;
1393 memcpy (data1, de, len); 1402 memcpy (data1, de, len);
1394 de = (struct ext4_dir_entry_2 *) data1; 1403 de = (struct ext4_dir_entry_2 *) data1;
1395 top = data1 + len; 1404 top = data1 + len;
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
index c328be5d688..c06886abd65 100644
--- a/fs/ext4/resize.c
+++ b/fs/ext4/resize.c
@@ -861,12 +861,13 @@ int ext4_group_add(struct super_block *sb, struct ext4_new_group_data *input)
861 gdp = (struct ext4_group_desc *)((char *)primary->b_data + 861 gdp = (struct ext4_group_desc *)((char *)primary->b_data +
862 gdb_off * EXT4_DESC_SIZE(sb)); 862 gdb_off * EXT4_DESC_SIZE(sb));
863 863
864 memset(gdp, 0, EXT4_DESC_SIZE(sb));
864 ext4_block_bitmap_set(sb, gdp, input->block_bitmap); /* LV FIXME */ 865 ext4_block_bitmap_set(sb, gdp, input->block_bitmap); /* LV FIXME */
865 ext4_inode_bitmap_set(sb, gdp, input->inode_bitmap); /* LV FIXME */ 866 ext4_inode_bitmap_set(sb, gdp, input->inode_bitmap); /* LV FIXME */
866 ext4_inode_table_set(sb, gdp, input->inode_table); /* LV FIXME */ 867 ext4_inode_table_set(sb, gdp, input->inode_table); /* LV FIXME */
867 ext4_free_blks_set(sb, gdp, input->free_blocks_count); 868 ext4_free_blks_set(sb, gdp, input->free_blocks_count);
868 ext4_free_inodes_set(sb, gdp, EXT4_INODES_PER_GROUP(sb)); 869 ext4_free_inodes_set(sb, gdp, EXT4_INODES_PER_GROUP(sb));
869 gdp->bg_flags |= cpu_to_le16(EXT4_BG_INODE_ZEROED); 870 gdp->bg_flags = cpu_to_le16(EXT4_BG_INODE_ZEROED);
870 gdp->bg_checksum = ext4_group_desc_csum(sbi, input->group, gdp); 871 gdp->bg_checksum = ext4_group_desc_csum(sbi, input->group, gdp);
871 872
872 /* 873 /*
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index 56675306ed8..eb343008ede 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -37,10 +37,10 @@
37#include <linux/proc_fs.h> 37#include <linux/proc_fs.h>
38#include <linux/debugfs.h> 38#include <linux/debugfs.h>
39#include <linux/seq_file.h> 39#include <linux/seq_file.h>
40#include <linux/math64.h>
40 41
41#include <asm/uaccess.h> 42#include <asm/uaccess.h>
42#include <asm/page.h> 43#include <asm/page.h>
43#include <asm/div64.h>
44 44
45EXPORT_SYMBOL(jbd2_journal_start); 45EXPORT_SYMBOL(jbd2_journal_start);
46EXPORT_SYMBOL(jbd2_journal_restart); 46EXPORT_SYMBOL(jbd2_journal_restart);
@@ -846,8 +846,8 @@ static int jbd2_seq_info_show(struct seq_file *seq, void *v)
846 jiffies_to_msecs(s->stats->u.run.rs_flushing / s->stats->ts_tid)); 846 jiffies_to_msecs(s->stats->u.run.rs_flushing / s->stats->ts_tid));
847 seq_printf(seq, " %ums logging transaction\n", 847 seq_printf(seq, " %ums logging transaction\n",
848 jiffies_to_msecs(s->stats->u.run.rs_logging / s->stats->ts_tid)); 848 jiffies_to_msecs(s->stats->u.run.rs_logging / s->stats->ts_tid));
849 seq_printf(seq, " %luus average transaction commit time\n", 849 seq_printf(seq, " %lluus average transaction commit time\n",
850 do_div(s->journal->j_average_commit_time, 1000)); 850 div_u64(s->journal->j_average_commit_time, 1000));
851 seq_printf(seq, " %lu handles per transaction\n", 851 seq_printf(seq, " %lu handles per transaction\n",
852 s->stats->u.run.rs_handle_count / s->stats->ts_tid); 852 s->stats->u.run.rs_handle_count / s->stats->ts_tid);
853 seq_printf(seq, " %lu blocks per transaction\n", 853 seq_printf(seq, " %lu blocks per transaction\n",
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 12e9a2957ca..2124c063a7e 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -41,6 +41,7 @@ header-y += baycom.h
41header-y += bfs_fs.h 41header-y += bfs_fs.h
42header-y += blkpg.h 42header-y += blkpg.h
43header-y += bpqether.h 43header-y += bpqether.h
44header-y += bsg.h
44header-y += can.h 45header-y += can.h
45header-y += cdk.h 46header-y += cdk.h
46header-y += chio.h 47header-y += chio.h
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 18462c5b8ff..0942765cf8c 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -144,7 +144,7 @@ struct bio {
144 * bit 1 -- rw-ahead when set 144 * bit 1 -- rw-ahead when set
145 * bit 2 -- barrier 145 * bit 2 -- barrier
146 * Insert a serialization point in the IO queue, forcing previously 146 * Insert a serialization point in the IO queue, forcing previously
147 * submitted IO to be completed before this oen is issued. 147 * submitted IO to be completed before this one is issued.
148 * bit 3 -- synchronous I/O hint: the block layer will unplug immediately 148 * bit 3 -- synchronous I/O hint: the block layer will unplug immediately
149 * Note that this does NOT indicate that the IO itself is sync, just 149 * Note that this does NOT indicate that the IO itself is sync, just
150 * that the block layer will not postpone issue of this IO by plugging. 150 * that the block layer will not postpone issue of this IO by plugging.
@@ -163,12 +163,33 @@ struct bio {
163#define BIO_RW 0 /* Must match RW in req flags (blkdev.h) */ 163#define BIO_RW 0 /* Must match RW in req flags (blkdev.h) */
164#define BIO_RW_AHEAD 1 /* Must match FAILFAST in req flags */ 164#define BIO_RW_AHEAD 1 /* Must match FAILFAST in req flags */
165#define BIO_RW_BARRIER 2 165#define BIO_RW_BARRIER 2
166#define BIO_RW_SYNC 3 166#define BIO_RW_SYNCIO 3
167#define BIO_RW_META 4 167#define BIO_RW_UNPLUG 4
168#define BIO_RW_DISCARD 5 168#define BIO_RW_META 5
169#define BIO_RW_FAILFAST_DEV 6 169#define BIO_RW_DISCARD 6
170#define BIO_RW_FAILFAST_TRANSPORT 7 170#define BIO_RW_FAILFAST_DEV 7
171#define BIO_RW_FAILFAST_DRIVER 8 171#define BIO_RW_FAILFAST_TRANSPORT 8
172#define BIO_RW_FAILFAST_DRIVER 9
173
174#define BIO_RW_SYNC (BIO_RW_SYNCIO | BIO_RW_UNPLUG)
175
176#define bio_rw_flagged(bio, flag) ((bio)->bi_rw & (1 << (flag)))
177
178/*
179 * Old defines, these should eventually be replaced by direct usage of
180 * bio_rw_flagged()
181 */
182#define bio_barrier(bio) bio_rw_flagged(bio, BIO_RW_BARRIER)
183#define bio_sync(bio) bio_rw_flagged(bio, BIO_RW_SYNCIO)
184#define bio_unplug(bio) bio_rw_flagged(bio, BIO_RW_UNPLUG)
185#define bio_failfast_dev(bio) bio_rw_flagged(bio, BIO_RW_FAILFAST_DEV)
186#define bio_failfast_transport(bio) \
187 bio_rw_flagged(bio, BIO_RW_FAILFAST_TRANSPORT)
188#define bio_failfast_driver(bio) \
189 bio_rw_flagged(bio, BIO_RW_FAILFAST_DRIVER)
190#define bio_rw_ahead(bio) bio_rw_flagged(bio, BIO_RW_AHEAD)
191#define bio_rw_meta(bio) bio_rw_flagged(bio, BIO_RW_META)
192#define bio_discard(bio) bio_rw_flagged(bio, BIO_RW_DISCARD)
172 193
173/* 194/*
174 * upper 16 bits of bi_rw define the io priority of this bio 195 * upper 16 bits of bi_rw define the io priority of this bio
@@ -193,15 +214,6 @@ struct bio {
193#define bio_offset(bio) bio_iovec((bio))->bv_offset 214#define bio_offset(bio) bio_iovec((bio))->bv_offset
194#define bio_segments(bio) ((bio)->bi_vcnt - (bio)->bi_idx) 215#define bio_segments(bio) ((bio)->bi_vcnt - (bio)->bi_idx)
195#define bio_sectors(bio) ((bio)->bi_size >> 9) 216#define bio_sectors(bio) ((bio)->bi_size >> 9)
196#define bio_barrier(bio) ((bio)->bi_rw & (1 << BIO_RW_BARRIER))
197#define bio_sync(bio) ((bio)->bi_rw & (1 << BIO_RW_SYNC))
198#define bio_failfast_dev(bio) ((bio)->bi_rw & (1 << BIO_RW_FAILFAST_DEV))
199#define bio_failfast_transport(bio) \
200 ((bio)->bi_rw & (1 << BIO_RW_FAILFAST_TRANSPORT))
201#define bio_failfast_driver(bio) ((bio)->bi_rw & (1 << BIO_RW_FAILFAST_DRIVER))
202#define bio_rw_ahead(bio) ((bio)->bi_rw & (1 << BIO_RW_AHEAD))
203#define bio_rw_meta(bio) ((bio)->bi_rw & (1 << BIO_RW_META))
204#define bio_discard(bio) ((bio)->bi_rw & (1 << BIO_RW_DISCARD))
205#define bio_empty_barrier(bio) (bio_barrier(bio) && !bio_has_data(bio) && !bio_discard(bio)) 217#define bio_empty_barrier(bio) (bio_barrier(bio) && !bio_has_data(bio) && !bio_discard(bio))
206 218
207static inline unsigned int bio_cur_sectors(struct bio *bio) 219static inline unsigned int bio_cur_sectors(struct bio *bio)
@@ -312,7 +324,6 @@ struct bio_integrity_payload {
312 void *bip_buf; /* generated integrity data */ 324 void *bip_buf; /* generated integrity data */
313 bio_end_io_t *bip_end_io; /* saved I/O completion fn */ 325 bio_end_io_t *bip_end_io; /* saved I/O completion fn */
314 326
315 int bip_error; /* saved I/O error */
316 unsigned int bip_size; 327 unsigned int bip_size;
317 328
318 unsigned short bip_pool; /* pool the ivec came from */ 329 unsigned short bip_pool; /* pool the ivec came from */
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 044467ef7b1..d08c4b8219a 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -108,6 +108,7 @@ enum rq_flag_bits {
108 __REQ_RW_META, /* metadata io request */ 108 __REQ_RW_META, /* metadata io request */
109 __REQ_COPY_USER, /* contains copies of user pages */ 109 __REQ_COPY_USER, /* contains copies of user pages */
110 __REQ_INTEGRITY, /* integrity metadata has been remapped */ 110 __REQ_INTEGRITY, /* integrity metadata has been remapped */
111 __REQ_UNPLUG, /* unplug queue on submission */
111 __REQ_NR_BITS, /* stops here */ 112 __REQ_NR_BITS, /* stops here */
112}; 113};
113 114
@@ -134,6 +135,7 @@ enum rq_flag_bits {
134#define REQ_RW_META (1 << __REQ_RW_META) 135#define REQ_RW_META (1 << __REQ_RW_META)
135#define REQ_COPY_USER (1 << __REQ_COPY_USER) 136#define REQ_COPY_USER (1 << __REQ_COPY_USER)
136#define REQ_INTEGRITY (1 << __REQ_INTEGRITY) 137#define REQ_INTEGRITY (1 << __REQ_INTEGRITY)
138#define REQ_UNPLUG (1 << __REQ_UNPLUG)
137 139
138#define BLK_MAX_CDB 16 140#define BLK_MAX_CDB 16
139 141
@@ -449,6 +451,11 @@ struct request_queue
449#define QUEUE_FLAG_STACKABLE 13 /* supports request stacking */ 451#define QUEUE_FLAG_STACKABLE 13 /* supports request stacking */
450#define QUEUE_FLAG_NONROT 14 /* non-rotational device (SSD) */ 452#define QUEUE_FLAG_NONROT 14 /* non-rotational device (SSD) */
451#define QUEUE_FLAG_VIRT QUEUE_FLAG_NONROT /* paravirt device */ 453#define QUEUE_FLAG_VIRT QUEUE_FLAG_NONROT /* paravirt device */
454#define QUEUE_FLAG_IO_STAT 15 /* do IO stats */
455
456#define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \
457 (1 << QUEUE_FLAG_CLUSTER) | \
458 1 << QUEUE_FLAG_STACKABLE)
452 459
453static inline int queue_is_locked(struct request_queue *q) 460static inline int queue_is_locked(struct request_queue *q)
454{ 461{
@@ -565,6 +572,7 @@ enum {
565#define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags) 572#define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags)
566#define blk_queue_nomerges(q) test_bit(QUEUE_FLAG_NOMERGES, &(q)->queue_flags) 573#define blk_queue_nomerges(q) test_bit(QUEUE_FLAG_NOMERGES, &(q)->queue_flags)
567#define blk_queue_nonrot(q) test_bit(QUEUE_FLAG_NONROT, &(q)->queue_flags) 574#define blk_queue_nonrot(q) test_bit(QUEUE_FLAG_NONROT, &(q)->queue_flags)
575#define blk_queue_io_stat(q) test_bit(QUEUE_FLAG_IO_STAT, &(q)->queue_flags)
568#define blk_queue_flushing(q) ((q)->ordseq) 576#define blk_queue_flushing(q) ((q)->ordseq)
569#define blk_queue_stackable(q) \ 577#define blk_queue_stackable(q) \
570 test_bit(QUEUE_FLAG_STACKABLE, &(q)->queue_flags) 578 test_bit(QUEUE_FLAG_STACKABLE, &(q)->queue_flags)
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index b45109c61fb..b28b37eb11c 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -308,7 +308,8 @@ void buffer_assertion_failure(struct buffer_head *bh);
308 int val = (expr); \ 308 int val = (expr); \
309 if (!val) { \ 309 if (!val) { \
310 printk(KERN_ERR \ 310 printk(KERN_ERR \
311 "EXT3-fs unexpected failure: %s;\n",# expr); \ 311 "JBD2 unexpected failure: %s: %s;\n", \
312 __func__, #expr); \
312 printk(KERN_ERR why "\n"); \ 313 printk(KERN_ERR why "\n"); \
313 } \ 314 } \
314 val; \ 315 val; \
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index f44bb5c77a7..d0a043153cc 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -182,7 +182,7 @@ static inline int inet_ehash_locks_alloc(struct inet_hashinfo *hashinfo)
182 size = 2048; 182 size = 2048;
183 if (nr_pcpus >= 32) 183 if (nr_pcpus >= 32)
184 size = 4096; 184 size = 4096;
185 if (sizeof(rwlock_t) != 0) { 185 if (sizeof(spinlock_t) != 0) {
186#ifdef CONFIG_NUMA 186#ifdef CONFIG_NUMA
187 if (size * sizeof(spinlock_t) > PAGE_SIZE) 187 if (size * sizeof(spinlock_t) > PAGE_SIZE)
188 hashinfo->ehash_locks = vmalloc(size * sizeof(spinlock_t)); 188 hashinfo->ehash_locks = vmalloc(size * sizeof(spinlock_t));
diff --git a/mm/mmap.c b/mm/mmap.c
index d3fa10a726c..c581df14d0d 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -658,6 +658,9 @@ again: remove_next = 1 + (end > next->vm_end);
658 validate_mm(mm); 658 validate_mm(mm);
659} 659}
660 660
661/* Flags that can be inherited from an existing mapping when merging */
662#define VM_MERGEABLE_FLAGS (VM_CAN_NONLINEAR)
663
661/* 664/*
662 * If the vma has a ->close operation then the driver probably needs to release 665 * If the vma has a ->close operation then the driver probably needs to release
663 * per-vma resources, so we don't attempt to merge those. 666 * per-vma resources, so we don't attempt to merge those.
@@ -665,7 +668,7 @@ again: remove_next = 1 + (end > next->vm_end);
665static inline int is_mergeable_vma(struct vm_area_struct *vma, 668static inline int is_mergeable_vma(struct vm_area_struct *vma,
666 struct file *file, unsigned long vm_flags) 669 struct file *file, unsigned long vm_flags)
667{ 670{
668 if (vma->vm_flags != vm_flags) 671 if ((vma->vm_flags ^ vm_flags) & ~VM_MERGEABLE_FLAGS)
669 return 0; 672 return 0;
670 if (vma->vm_file != file) 673 if (vma->vm_file != file)
671 return 0; 674 return 0;
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 2e5f2ca3bdc..da74b844f4e 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -2212,10 +2212,10 @@ unsigned int skb_seq_read(unsigned int consumed, const u8 **data,
2212 return 0; 2212 return 0;
2213 2213
2214next_skb: 2214next_skb:
2215 block_limit = skb_headlen(st->cur_skb); 2215 block_limit = skb_headlen(st->cur_skb) + st->stepped_offset;
2216 2216
2217 if (abs_offset < block_limit) { 2217 if (abs_offset < block_limit) {
2218 *data = st->cur_skb->data + abs_offset; 2218 *data = st->cur_skb->data + (abs_offset - st->stepped_offset);
2219 return block_limit - abs_offset; 2219 return block_limit - abs_offset;
2220 } 2220 }
2221 2221
@@ -2250,13 +2250,14 @@ next_skb:
2250 st->frag_data = NULL; 2250 st->frag_data = NULL;
2251 } 2251 }
2252 2252
2253 if (st->cur_skb->next) { 2253 if (st->root_skb == st->cur_skb &&
2254 st->cur_skb = st->cur_skb->next; 2254 skb_shinfo(st->root_skb)->frag_list) {
2255 st->cur_skb = skb_shinfo(st->root_skb)->frag_list;
2255 st->frag_idx = 0; 2256 st->frag_idx = 0;
2256 goto next_skb; 2257 goto next_skb;
2257 } else if (st->root_skb == st->cur_skb && 2258 } else if (st->cur_skb->next) {
2258 skb_shinfo(st->root_skb)->frag_list) { 2259 st->cur_skb = st->cur_skb->next;
2259 st->cur_skb = skb_shinfo(st->root_skb)->frag_list; 2260 st->frag_idx = 0;
2260 goto next_skb; 2261 goto next_skb;
2261 } 2262 }
2262 2263
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
index 42a0f3dd3fd..d722013c1ca 100644
--- a/net/ipv4/ipconfig.c
+++ b/net/ipv4/ipconfig.c
@@ -1268,6 +1268,9 @@ __be32 __init root_nfs_parse_addr(char *name)
1268static int __init ip_auto_config(void) 1268static int __init ip_auto_config(void)
1269{ 1269{
1270 __be32 addr; 1270 __be32 addr;
1271#ifdef IPCONFIG_DYNAMIC
1272 int retries = CONF_OPEN_RETRIES;
1273#endif
1271 1274
1272#ifdef CONFIG_PROC_FS 1275#ifdef CONFIG_PROC_FS
1273 proc_net_fops_create(&init_net, "pnp", S_IRUGO, &pnp_seq_fops); 1276 proc_net_fops_create(&init_net, "pnp", S_IRUGO, &pnp_seq_fops);
@@ -1304,9 +1307,6 @@ static int __init ip_auto_config(void)
1304#endif 1307#endif
1305 ic_first_dev->next) { 1308 ic_first_dev->next) {
1306#ifdef IPCONFIG_DYNAMIC 1309#ifdef IPCONFIG_DYNAMIC
1307
1308 int retries = CONF_OPEN_RETRIES;
1309
1310 if (ic_dynamic() < 0) { 1310 if (ic_dynamic() < 0) {
1311 ic_close_devs(); 1311 ic_close_devs();
1312 1312
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 0cd71b84e48..76b148bcb0d 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -524,7 +524,8 @@ static int tcp_splice_data_recv(read_descriptor_t *rd_desc, struct sk_buff *skb,
524 struct tcp_splice_state *tss = rd_desc->arg.data; 524 struct tcp_splice_state *tss = rd_desc->arg.data;
525 int ret; 525 int ret;
526 526
527 ret = skb_splice_bits(skb, offset, tss->pipe, rd_desc->count, tss->flags); 527 ret = skb_splice_bits(skb, offset, tss->pipe, min(rd_desc->count, len),
528 tss->flags);
528 if (ret > 0) 529 if (ret > 0)
529 rd_desc->count -= ret; 530 rd_desc->count -= ret;
530 return ret; 531 return ret;
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index cf5ab0581eb..b7faffe5c02 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -120,8 +120,11 @@ EXPORT_SYMBOL(sysctl_udp_wmem_min);
120atomic_t udp_memory_allocated; 120atomic_t udp_memory_allocated;
121EXPORT_SYMBOL(udp_memory_allocated); 121EXPORT_SYMBOL(udp_memory_allocated);
122 122
123#define PORTS_PER_CHAIN (65536 / UDP_HTABLE_SIZE)
124
123static int udp_lib_lport_inuse(struct net *net, __u16 num, 125static int udp_lib_lport_inuse(struct net *net, __u16 num,
124 const struct udp_hslot *hslot, 126 const struct udp_hslot *hslot,
127 unsigned long *bitmap,
125 struct sock *sk, 128 struct sock *sk,
126 int (*saddr_comp)(const struct sock *sk1, 129 int (*saddr_comp)(const struct sock *sk1,
127 const struct sock *sk2)) 130 const struct sock *sk2))
@@ -132,12 +135,17 @@ static int udp_lib_lport_inuse(struct net *net, __u16 num,
132 sk_nulls_for_each(sk2, node, &hslot->head) 135 sk_nulls_for_each(sk2, node, &hslot->head)
133 if (net_eq(sock_net(sk2), net) && 136 if (net_eq(sock_net(sk2), net) &&
134 sk2 != sk && 137 sk2 != sk &&
135 sk2->sk_hash == num && 138 (bitmap || sk2->sk_hash == num) &&
136 (!sk2->sk_reuse || !sk->sk_reuse) && 139 (!sk2->sk_reuse || !sk->sk_reuse) &&
137 (!sk2->sk_bound_dev_if || !sk->sk_bound_dev_if 140 (!sk2->sk_bound_dev_if || !sk->sk_bound_dev_if
138 || sk2->sk_bound_dev_if == sk->sk_bound_dev_if) && 141 || sk2->sk_bound_dev_if == sk->sk_bound_dev_if) &&
139 (*saddr_comp)(sk, sk2)) 142 (*saddr_comp)(sk, sk2)) {
140 return 1; 143 if (bitmap)
144 __set_bit(sk2->sk_hash / UDP_HTABLE_SIZE,
145 bitmap);
146 else
147 return 1;
148 }
141 return 0; 149 return 0;
142} 150}
143 151
@@ -160,32 +168,47 @@ int udp_lib_get_port(struct sock *sk, unsigned short snum,
160 if (!snum) { 168 if (!snum) {
161 int low, high, remaining; 169 int low, high, remaining;
162 unsigned rand; 170 unsigned rand;
163 unsigned short first; 171 unsigned short first, last;
172 DECLARE_BITMAP(bitmap, PORTS_PER_CHAIN);
164 173
165 inet_get_local_port_range(&low, &high); 174 inet_get_local_port_range(&low, &high);
166 remaining = (high - low) + 1; 175 remaining = (high - low) + 1;
167 176
168 rand = net_random(); 177 rand = net_random();
169 snum = first = rand % remaining + low; 178 first = (((u64)rand * remaining) >> 32) + low;
170 rand |= 1; 179 /*
171 for (;;) { 180 * force rand to be an odd multiple of UDP_HTABLE_SIZE
172 hslot = &udptable->hash[udp_hashfn(net, snum)]; 181 */
182 rand = (rand | 1) * UDP_HTABLE_SIZE;
183 for (last = first + UDP_HTABLE_SIZE; first != last; first++) {
184 hslot = &udptable->hash[udp_hashfn(net, first)];
185 bitmap_zero(bitmap, PORTS_PER_CHAIN);
173 spin_lock_bh(&hslot->lock); 186 spin_lock_bh(&hslot->lock);
174 if (!udp_lib_lport_inuse(net, snum, hslot, sk, saddr_comp)) 187 udp_lib_lport_inuse(net, snum, hslot, bitmap, sk,
175 break; 188 saddr_comp);
176 spin_unlock_bh(&hslot->lock); 189
190 snum = first;
191 /*
192 * Iterate on all possible values of snum for this hash.
193 * Using steps of an odd multiple of UDP_HTABLE_SIZE
194 * give us randomization and full range coverage.
195 */
177 do { 196 do {
178 snum = snum + rand; 197 if (low <= snum && snum <= high &&
179 } while (snum < low || snum > high); 198 !test_bit(snum / UDP_HTABLE_SIZE, bitmap))
180 if (snum == first) 199 goto found;
181 goto fail; 200 snum += rand;
201 } while (snum != first);
202 spin_unlock_bh(&hslot->lock);
182 } 203 }
204 goto fail;
183 } else { 205 } else {
184 hslot = &udptable->hash[udp_hashfn(net, snum)]; 206 hslot = &udptable->hash[udp_hashfn(net, snum)];
185 spin_lock_bh(&hslot->lock); 207 spin_lock_bh(&hslot->lock);
186 if (udp_lib_lport_inuse(net, snum, hslot, sk, saddr_comp)) 208 if (udp_lib_lport_inuse(net, snum, hslot, NULL, sk, saddr_comp))
187 goto fail_unlock; 209 goto fail_unlock;
188 } 210 }
211found:
189 inet_sk(sk)->num = snum; 212 inet_sk(sk)->num = snum;
190 sk->sk_hash = snum; 213 sk->sk_hash = snum;
191 if (sk_unhashed(sk)) { 214 if (sk_unhashed(sk)) {
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index e92ad8455c6..f9afb452249 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -4250,7 +4250,7 @@ static struct addrconf_sysctl_table
4250 .procname = "mc_forwarding", 4250 .procname = "mc_forwarding",
4251 .data = &ipv6_devconf.mc_forwarding, 4251 .data = &ipv6_devconf.mc_forwarding,
4252 .maxlen = sizeof(int), 4252 .maxlen = sizeof(int),
4253 .mode = 0644, 4253 .mode = 0444,
4254 .proc_handler = proc_dointvec, 4254 .proc_handler = proc_dointvec,
4255 }, 4255 },
4256#endif 4256#endif
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
index 4f433847d95..36dff880718 100644
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -443,10 +443,10 @@ void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info,
443 if (xfrm_decode_session_reverse(skb, &fl2, AF_INET6)) 443 if (xfrm_decode_session_reverse(skb, &fl2, AF_INET6))
444 goto relookup_failed; 444 goto relookup_failed;
445 445
446 if (ip6_dst_lookup(sk, &dst2, &fl)) 446 if (ip6_dst_lookup(sk, &dst2, &fl2))
447 goto relookup_failed; 447 goto relookup_failed;
448 448
449 err = xfrm_lookup(net, &dst2, &fl, sk, XFRM_LOOKUP_ICMP); 449 err = xfrm_lookup(net, &dst2, &fl2, sk, XFRM_LOOKUP_ICMP);
450 switch (err) { 450 switch (err) {
451 case 0: 451 case 0:
452 dst_release(dst); 452 dst_release(dst);
diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c
index 936f48946e2..f171e8dbac9 100644
--- a/net/ipv6/ip6_input.c
+++ b/net/ipv6/ip6_input.c
@@ -255,6 +255,7 @@ int ip6_mc_input(struct sk_buff *skb)
255 * IPv6 multicast router mode is now supported ;) 255 * IPv6 multicast router mode is now supported ;)
256 */ 256 */
257 if (dev_net(skb->dev)->ipv6.devconf_all->mc_forwarding && 257 if (dev_net(skb->dev)->ipv6.devconf_all->mc_forwarding &&
258 !(ipv6_addr_type(&hdr->daddr) & IPV6_ADDR_LINKLOCAL) &&
258 likely(!(IP6CB(skb)->flags & IP6SKB_FORWARDED))) { 259 likely(!(IP6CB(skb)->flags & IP6SKB_FORWARDED))) {
259 /* 260 /*
260 * Okay, we try to forward - split and duplicate 261 * Okay, we try to forward - split and duplicate
@@ -316,7 +317,6 @@ int ip6_mc_input(struct sk_buff *skb)
316 } 317 }
317 318
318 if (skb2) { 319 if (skb2) {
319 skb2->dev = skb2->dst->dev;
320 ip6_mr_input(skb2); 320 ip6_mr_input(skb2);
321 } 321 }
322 } 322 }
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index 3c51b2d827f..d19a84b7950 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -365,7 +365,9 @@ static int pim6_rcv(struct sk_buff *skb)
365 pim = (struct pimreghdr *)skb_transport_header(skb); 365 pim = (struct pimreghdr *)skb_transport_header(skb);
366 if (pim->type != ((PIM_VERSION << 4) | PIM_REGISTER) || 366 if (pim->type != ((PIM_VERSION << 4) | PIM_REGISTER) ||
367 (pim->flags & PIM_NULL_REGISTER) || 367 (pim->flags & PIM_NULL_REGISTER) ||
368 (ip_compute_csum((void *)pim, sizeof(*pim)) != 0 && 368 (csum_ipv6_magic(&ipv6_hdr(skb)->saddr, &ipv6_hdr(skb)->daddr,
369 sizeof(*pim), IPPROTO_PIM,
370 csum_partial((void *)pim, sizeof(*pim), 0)) &&
369 csum_fold(skb_checksum(skb, 0, skb->len, 0)))) 371 csum_fold(skb_checksum(skb, 0, skb->len, 0))))
370 goto drop; 372 goto drop;
371 373
@@ -392,7 +394,7 @@ static int pim6_rcv(struct sk_buff *skb)
392 skb_pull(skb, (u8 *)encap - skb->data); 394 skb_pull(skb, (u8 *)encap - skb->data);
393 skb_reset_network_header(skb); 395 skb_reset_network_header(skb);
394 skb->dev = reg_dev; 396 skb->dev = reg_dev;
395 skb->protocol = htons(ETH_P_IP); 397 skb->protocol = htons(ETH_P_IPV6);
396 skb->ip_summed = 0; 398 skb->ip_summed = 0;
397 skb->pkt_type = PACKET_HOST; 399 skb->pkt_type = PACKET_HOST;
398 dst_release(skb->dst); 400 dst_release(skb->dst);
@@ -481,6 +483,7 @@ static int mif6_delete(struct net *net, int vifi)
481{ 483{
482 struct mif_device *v; 484 struct mif_device *v;
483 struct net_device *dev; 485 struct net_device *dev;
486 struct inet6_dev *in6_dev;
484 if (vifi < 0 || vifi >= net->ipv6.maxvif) 487 if (vifi < 0 || vifi >= net->ipv6.maxvif)
485 return -EADDRNOTAVAIL; 488 return -EADDRNOTAVAIL;
486 489
@@ -513,6 +516,10 @@ static int mif6_delete(struct net *net, int vifi)
513 516
514 dev_set_allmulti(dev, -1); 517 dev_set_allmulti(dev, -1);
515 518
519 in6_dev = __in6_dev_get(dev);
520 if (in6_dev)
521 in6_dev->cnf.mc_forwarding--;
522
516 if (v->flags & MIFF_REGISTER) 523 if (v->flags & MIFF_REGISTER)
517 unregister_netdevice(dev); 524 unregister_netdevice(dev);
518 525
@@ -622,6 +629,7 @@ static int mif6_add(struct net *net, struct mif6ctl *vifc, int mrtsock)
622 int vifi = vifc->mif6c_mifi; 629 int vifi = vifc->mif6c_mifi;
623 struct mif_device *v = &net->ipv6.vif6_table[vifi]; 630 struct mif_device *v = &net->ipv6.vif6_table[vifi];
624 struct net_device *dev; 631 struct net_device *dev;
632 struct inet6_dev *in6_dev;
625 int err; 633 int err;
626 634
627 /* Is vif busy ? */ 635 /* Is vif busy ? */
@@ -662,6 +670,10 @@ static int mif6_add(struct net *net, struct mif6ctl *vifc, int mrtsock)
662 return -EINVAL; 670 return -EINVAL;
663 } 671 }
664 672
673 in6_dev = __in6_dev_get(dev);
674 if (in6_dev)
675 in6_dev->cnf.mc_forwarding++;
676
665 /* 677 /*
666 * Fill in the VIF structures 678 * Fill in the VIF structures
667 */ 679 */
@@ -838,8 +850,6 @@ static int ip6mr_cache_report(struct net *net, struct sk_buff *pkt, mifi_t mifi,
838 850
839 skb->dst = dst_clone(pkt->dst); 851 skb->dst = dst_clone(pkt->dst);
840 skb->ip_summed = CHECKSUM_UNNECESSARY; 852 skb->ip_summed = CHECKSUM_UNNECESSARY;
841
842 skb_pull(skb, sizeof(struct ipv6hdr));
843 } 853 }
844 854
845 if (net->ipv6.mroute6_sk == NULL) { 855 if (net->ipv6.mroute6_sk == NULL) {
@@ -1222,8 +1232,10 @@ static int ip6mr_sk_init(struct sock *sk)
1222 1232
1223 rtnl_lock(); 1233 rtnl_lock();
1224 write_lock_bh(&mrt_lock); 1234 write_lock_bh(&mrt_lock);
1225 if (likely(net->ipv6.mroute6_sk == NULL)) 1235 if (likely(net->ipv6.mroute6_sk == NULL)) {
1226 net->ipv6.mroute6_sk = sk; 1236 net->ipv6.mroute6_sk = sk;
1237 net->ipv6.devconf_all->mc_forwarding++;
1238 }
1227 else 1239 else
1228 err = -EADDRINUSE; 1240 err = -EADDRINUSE;
1229 write_unlock_bh(&mrt_lock); 1241 write_unlock_bh(&mrt_lock);
@@ -1242,6 +1254,7 @@ int ip6mr_sk_done(struct sock *sk)
1242 if (sk == net->ipv6.mroute6_sk) { 1254 if (sk == net->ipv6.mroute6_sk) {
1243 write_lock_bh(&mrt_lock); 1255 write_lock_bh(&mrt_lock);
1244 net->ipv6.mroute6_sk = NULL; 1256 net->ipv6.mroute6_sk = NULL;
1257 net->ipv6.devconf_all->mc_forwarding--;
1245 write_unlock_bh(&mrt_lock); 1258 write_unlock_bh(&mrt_lock);
1246 1259
1247 mroute_clean_tables(net); 1260 mroute_clean_tables(net);
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index c4a59824ac2..9c574235c90 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -794,7 +794,7 @@ void ip6_route_input(struct sk_buff *skb)
794 .proto = iph->nexthdr, 794 .proto = iph->nexthdr,
795 }; 795 };
796 796
797 if (rt6_need_strict(&iph->daddr)) 797 if (rt6_need_strict(&iph->daddr) && skb->dev->type != ARPHRD_PIMREG)
798 flags |= RT6_LOOKUP_F_IFACE; 798 flags |= RT6_LOOKUP_F_IFACE;
799 799
800 skb->dst = fib6_rule_lookup(net, &fl, flags, ip6_pol_route_input); 800 skb->dst = fib6_rule_lookup(net, &fl, flags, ip6_pol_route_input);
diff --git a/net/wimax/debugfs.c b/net/wimax/debugfs.c
index 87cf4430079..94d216a4640 100644
--- a/net/wimax/debugfs.c
+++ b/net/wimax/debugfs.c
@@ -28,17 +28,6 @@
28#include "debug-levels.h" 28#include "debug-levels.h"
29 29
30 30
31/* Debug framework control of debug levels */
32struct d_level D_LEVEL[] = {
33 D_SUBMODULE_DEFINE(debugfs),
34 D_SUBMODULE_DEFINE(id_table),
35 D_SUBMODULE_DEFINE(op_msg),
36 D_SUBMODULE_DEFINE(op_reset),
37 D_SUBMODULE_DEFINE(op_rfkill),
38 D_SUBMODULE_DEFINE(stack),
39};
40size_t D_LEVEL_SIZE = ARRAY_SIZE(D_LEVEL);
41
42#define __debugfs_register(prefix, name, parent) \ 31#define __debugfs_register(prefix, name, parent) \
43do { \ 32do { \
44 result = d_level_register_debugfs(prefix, name, parent); \ 33 result = d_level_register_debugfs(prefix, name, parent); \
diff --git a/net/wimax/stack.c b/net/wimax/stack.c
index d4da92f8981..3869c032788 100644
--- a/net/wimax/stack.c
+++ b/net/wimax/stack.c
@@ -516,6 +516,19 @@ void wimax_dev_rm(struct wimax_dev *wimax_dev)
516} 516}
517EXPORT_SYMBOL_GPL(wimax_dev_rm); 517EXPORT_SYMBOL_GPL(wimax_dev_rm);
518 518
519
520/* Debug framework control of debug levels */
521struct d_level D_LEVEL[] = {
522 D_SUBMODULE_DEFINE(debugfs),
523 D_SUBMODULE_DEFINE(id_table),
524 D_SUBMODULE_DEFINE(op_msg),
525 D_SUBMODULE_DEFINE(op_reset),
526 D_SUBMODULE_DEFINE(op_rfkill),
527 D_SUBMODULE_DEFINE(stack),
528};
529size_t D_LEVEL_SIZE = ARRAY_SIZE(D_LEVEL);
530
531
519struct genl_family wimax_gnl_family = { 532struct genl_family wimax_gnl_family = {
520 .id = GENL_ID_GENERATE, 533 .id = GENL_ID_GENERATE,
521 .name = "WiMAX", 534 .name = "WiMAX",
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index bc494cef210..85c9034c59b 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -498,6 +498,7 @@ static struct ieee80211_regdomain *country_ie_2_rd(
498 * calculate the number of reg rules we will need. We will need one 498 * calculate the number of reg rules we will need. We will need one
499 * for each channel subband */ 499 * for each channel subband */
500 while (country_ie_len >= 3) { 500 while (country_ie_len >= 3) {
501 int end_channel = 0;
501 struct ieee80211_country_ie_triplet *triplet = 502 struct ieee80211_country_ie_triplet *triplet =
502 (struct ieee80211_country_ie_triplet *) country_ie; 503 (struct ieee80211_country_ie_triplet *) country_ie;
503 int cur_sub_max_channel = 0, cur_channel = 0; 504 int cur_sub_max_channel = 0, cur_channel = 0;
@@ -509,9 +510,25 @@ static struct ieee80211_regdomain *country_ie_2_rd(
509 continue; 510 continue;
510 } 511 }
511 512
513 /* 2 GHz */
514 if (triplet->chans.first_channel <= 14)
515 end_channel = triplet->chans.first_channel +
516 triplet->chans.num_channels;
517 else
518 /*
519 * 5 GHz -- For example in country IEs if the first
520 * channel given is 36 and the number of channels is 4
521 * then the individual channel numbers defined for the
522 * 5 GHz PHY by these parameters are: 36, 40, 44, and 48
523 * and not 36, 37, 38, 39.
524 *
525 * See: http://tinyurl.com/11d-clarification
526 */
527 end_channel = triplet->chans.first_channel +
528 (4 * (triplet->chans.num_channels - 1));
529
512 cur_channel = triplet->chans.first_channel; 530 cur_channel = triplet->chans.first_channel;
513 cur_sub_max_channel = ieee80211_channel_to_frequency( 531 cur_sub_max_channel = end_channel;
514 cur_channel + triplet->chans.num_channels);
515 532
516 /* Basic sanity check */ 533 /* Basic sanity check */
517 if (cur_sub_max_channel < cur_channel) 534 if (cur_sub_max_channel < cur_channel)
@@ -590,15 +607,6 @@ static struct ieee80211_regdomain *country_ie_2_rd(
590 end_channel = triplet->chans.first_channel + 607 end_channel = triplet->chans.first_channel +
591 triplet->chans.num_channels; 608 triplet->chans.num_channels;
592 else 609 else
593 /*
594 * 5 GHz -- For example in country IEs if the first
595 * channel given is 36 and the number of channels is 4
596 * then the individual channel numbers defined for the
597 * 5 GHz PHY by these parameters are: 36, 40, 44, and 48
598 * and not 36, 37, 38, 39.
599 *
600 * See: http://tinyurl.com/11d-clarification
601 */
602 end_channel = triplet->chans.first_channel + 610 end_channel = triplet->chans.first_channel +
603 (4 * (triplet->chans.num_channels - 1)); 611 (4 * (triplet->chans.num_channels - 1));
604 612
@@ -1276,7 +1284,7 @@ static void reg_country_ie_process_debug(
1276 if (intersected_rd) { 1284 if (intersected_rd) {
1277 printk(KERN_DEBUG "cfg80211: We intersect both of these " 1285 printk(KERN_DEBUG "cfg80211: We intersect both of these "
1278 "and get:\n"); 1286 "and get:\n");
1279 print_regdomain_info(rd); 1287 print_regdomain_info(intersected_rd);
1280 return; 1288 return;
1281 } 1289 }
1282 printk(KERN_DEBUG "cfg80211: Intersection between both failed\n"); 1290 printk(KERN_DEBUG "cfg80211: Intersection between both failed\n");