diff options
46 files changed, 637 insertions, 466 deletions
diff --git a/Documentation/networking/bonding.txt b/Documentation/networking/bonding.txt index b0fe41da007b..8d8b4e5ea184 100644 --- a/Documentation/networking/bonding.txt +++ b/Documentation/networking/bonding.txt | |||
@@ -945,7 +945,6 @@ bond0 Link encap:Ethernet HWaddr 00:C0:F0:1F:37:B4 | |||
945 | collisions:0 txqueuelen:0 | 945 | collisions:0 txqueuelen:0 |
946 | 946 | ||
947 | eth0 Link encap:Ethernet HWaddr 00:C0:F0:1F:37:B4 | 947 | eth0 Link encap:Ethernet HWaddr 00:C0:F0:1F:37:B4 |
948 | inet addr:XXX.XXX.XXX.YYY Bcast:XXX.XXX.XXX.255 Mask:255.255.252.0 | ||
949 | UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1 | 948 | UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1 |
950 | RX packets:3573025 errors:0 dropped:0 overruns:0 frame:0 | 949 | RX packets:3573025 errors:0 dropped:0 overruns:0 frame:0 |
951 | TX packets:1643167 errors:1 dropped:0 overruns:1 carrier:0 | 950 | TX packets:1643167 errors:1 dropped:0 overruns:1 carrier:0 |
@@ -953,7 +952,6 @@ eth0 Link encap:Ethernet HWaddr 00:C0:F0:1F:37:B4 | |||
953 | Interrupt:10 Base address:0x1080 | 952 | Interrupt:10 Base address:0x1080 |
954 | 953 | ||
955 | eth1 Link encap:Ethernet HWaddr 00:C0:F0:1F:37:B4 | 954 | eth1 Link encap:Ethernet HWaddr 00:C0:F0:1F:37:B4 |
956 | inet addr:XXX.XXX.XXX.YYY Bcast:XXX.XXX.XXX.255 Mask:255.255.252.0 | ||
957 | UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1 | 955 | UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1 |
958 | RX packets:3651769 errors:0 dropped:0 overruns:0 frame:0 | 956 | RX packets:3651769 errors:0 dropped:0 overruns:0 frame:0 |
959 | TX packets:1643480 errors:0 dropped:0 overruns:0 carrier:0 | 957 | TX packets:1643480 errors:0 dropped:0 overruns:0 carrier:0 |
diff --git a/MAINTAINERS b/MAINTAINERS index 76dc820bc889..270e28c0506a 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -1697,7 +1697,6 @@ S: Maintained | |||
1697 | 1697 | ||
1698 | MARVELL MV64340 ETHERNET DRIVER | 1698 | MARVELL MV64340 ETHERNET DRIVER |
1699 | P: Manish Lachwani | 1699 | P: Manish Lachwani |
1700 | M: Manish_Lachwani@pmc-sierra.com | ||
1701 | L: linux-mips@linux-mips.org | 1700 | L: linux-mips@linux-mips.org |
1702 | L: netdev@vger.kernel.org | 1701 | L: netdev@vger.kernel.org |
1703 | S: Supported | 1702 | S: Supported |
diff --git a/block/elevator.c b/block/elevator.c index 39dcccc82ada..99a4d7b2f8ad 100644 --- a/block/elevator.c +++ b/block/elevator.c | |||
@@ -64,7 +64,7 @@ inline int elv_rq_merge_ok(struct request *rq, struct bio *bio) | |||
64 | } | 64 | } |
65 | EXPORT_SYMBOL(elv_rq_merge_ok); | 65 | EXPORT_SYMBOL(elv_rq_merge_ok); |
66 | 66 | ||
67 | inline int elv_try_merge(struct request *__rq, struct bio *bio) | 67 | static inline int elv_try_merge(struct request *__rq, struct bio *bio) |
68 | { | 68 | { |
69 | int ret = ELEVATOR_NO_MERGE; | 69 | int ret = ELEVATOR_NO_MERGE; |
70 | 70 | ||
@@ -80,7 +80,6 @@ inline int elv_try_merge(struct request *__rq, struct bio *bio) | |||
80 | 80 | ||
81 | return ret; | 81 | return ret; |
82 | } | 82 | } |
83 | EXPORT_SYMBOL(elv_try_merge); | ||
84 | 83 | ||
85 | static struct elevator_type *elevator_find(const char *name) | 84 | static struct elevator_type *elevator_find(const char *name) |
86 | { | 85 | { |
diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c index 91d3b4828c49..8e27d0ab0d7c 100644 --- a/block/ll_rw_blk.c +++ b/block/ll_rw_blk.c | |||
@@ -26,7 +26,8 @@ | |||
26 | #include <linux/slab.h> | 26 | #include <linux/slab.h> |
27 | #include <linux/swap.h> | 27 | #include <linux/swap.h> |
28 | #include <linux/writeback.h> | 28 | #include <linux/writeback.h> |
29 | #include <linux/blkdev.h> | 29 | #include <linux/interrupt.h> |
30 | #include <linux/cpu.h> | ||
30 | 31 | ||
31 | /* | 32 | /* |
32 | * for max sense size | 33 | * for max sense size |
@@ -62,13 +63,15 @@ static wait_queue_head_t congestion_wqh[2] = { | |||
62 | /* | 63 | /* |
63 | * Controlling structure to kblockd | 64 | * Controlling structure to kblockd |
64 | */ | 65 | */ |
65 | static struct workqueue_struct *kblockd_workqueue; | 66 | static struct workqueue_struct *kblockd_workqueue; |
66 | 67 | ||
67 | unsigned long blk_max_low_pfn, blk_max_pfn; | 68 | unsigned long blk_max_low_pfn, blk_max_pfn; |
68 | 69 | ||
69 | EXPORT_SYMBOL(blk_max_low_pfn); | 70 | EXPORT_SYMBOL(blk_max_low_pfn); |
70 | EXPORT_SYMBOL(blk_max_pfn); | 71 | EXPORT_SYMBOL(blk_max_pfn); |
71 | 72 | ||
73 | static DEFINE_PER_CPU(struct list_head, blk_cpu_done); | ||
74 | |||
72 | /* Amount of time in which a process may batch requests */ | 75 | /* Amount of time in which a process may batch requests */ |
73 | #define BLK_BATCH_TIME (HZ/50UL) | 76 | #define BLK_BATCH_TIME (HZ/50UL) |
74 | 77 | ||
@@ -207,6 +210,13 @@ void blk_queue_merge_bvec(request_queue_t *q, merge_bvec_fn *mbfn) | |||
207 | 210 | ||
208 | EXPORT_SYMBOL(blk_queue_merge_bvec); | 211 | EXPORT_SYMBOL(blk_queue_merge_bvec); |
209 | 212 | ||
213 | void blk_queue_softirq_done(request_queue_t *q, softirq_done_fn *fn) | ||
214 | { | ||
215 | q->softirq_done_fn = fn; | ||
216 | } | ||
217 | |||
218 | EXPORT_SYMBOL(blk_queue_softirq_done); | ||
219 | |||
210 | /** | 220 | /** |
211 | * blk_queue_make_request - define an alternate make_request function for a device | 221 | * blk_queue_make_request - define an alternate make_request function for a device |
212 | * @q: the request queue for the device to be affected | 222 | * @q: the request queue for the device to be affected |
@@ -270,6 +280,7 @@ EXPORT_SYMBOL(blk_queue_make_request); | |||
270 | static inline void rq_init(request_queue_t *q, struct request *rq) | 280 | static inline void rq_init(request_queue_t *q, struct request *rq) |
271 | { | 281 | { |
272 | INIT_LIST_HEAD(&rq->queuelist); | 282 | INIT_LIST_HEAD(&rq->queuelist); |
283 | INIT_LIST_HEAD(&rq->donelist); | ||
273 | 284 | ||
274 | rq->errors = 0; | 285 | rq->errors = 0; |
275 | rq->rq_status = RQ_ACTIVE; | 286 | rq->rq_status = RQ_ACTIVE; |
@@ -286,6 +297,7 @@ static inline void rq_init(request_queue_t *q, struct request *rq) | |||
286 | rq->sense = NULL; | 297 | rq->sense = NULL; |
287 | rq->end_io = NULL; | 298 | rq->end_io = NULL; |
288 | rq->end_io_data = NULL; | 299 | rq->end_io_data = NULL; |
300 | rq->completion_data = NULL; | ||
289 | } | 301 | } |
290 | 302 | ||
291 | /** | 303 | /** |
@@ -2735,30 +2747,6 @@ static inline int attempt_front_merge(request_queue_t *q, struct request *rq) | |||
2735 | return 0; | 2747 | return 0; |
2736 | } | 2748 | } |
2737 | 2749 | ||
2738 | /** | ||
2739 | * blk_attempt_remerge - attempt to remerge active head with next request | ||
2740 | * @q: The &request_queue_t belonging to the device | ||
2741 | * @rq: The head request (usually) | ||
2742 | * | ||
2743 | * Description: | ||
2744 | * For head-active devices, the queue can easily be unplugged so quickly | ||
2745 | * that proper merging is not done on the front request. This may hurt | ||
2746 | * performance greatly for some devices. The block layer cannot safely | ||
2747 | * do merging on that first request for these queues, but the driver can | ||
2748 | * call this function and make it happen any way. Only the driver knows | ||
2749 | * when it is safe to do so. | ||
2750 | **/ | ||
2751 | void blk_attempt_remerge(request_queue_t *q, struct request *rq) | ||
2752 | { | ||
2753 | unsigned long flags; | ||
2754 | |||
2755 | spin_lock_irqsave(q->queue_lock, flags); | ||
2756 | attempt_back_merge(q, rq); | ||
2757 | spin_unlock_irqrestore(q->queue_lock, flags); | ||
2758 | } | ||
2759 | |||
2760 | EXPORT_SYMBOL(blk_attempt_remerge); | ||
2761 | |||
2762 | static void init_request_from_bio(struct request *req, struct bio *bio) | 2750 | static void init_request_from_bio(struct request *req, struct bio *bio) |
2763 | { | 2751 | { |
2764 | req->flags |= REQ_CMD; | 2752 | req->flags |= REQ_CMD; |
@@ -3287,6 +3275,87 @@ int end_that_request_chunk(struct request *req, int uptodate, int nr_bytes) | |||
3287 | EXPORT_SYMBOL(end_that_request_chunk); | 3275 | EXPORT_SYMBOL(end_that_request_chunk); |
3288 | 3276 | ||
3289 | /* | 3277 | /* |
3278 | * splice the completion data to a local structure and hand off to | ||
3279 | * process_completion_queue() to complete the requests | ||
3280 | */ | ||
3281 | static void blk_done_softirq(struct softirq_action *h) | ||
3282 | { | ||
3283 | struct list_head *cpu_list; | ||
3284 | LIST_HEAD(local_list); | ||
3285 | |||
3286 | local_irq_disable(); | ||
3287 | cpu_list = &__get_cpu_var(blk_cpu_done); | ||
3288 | list_splice_init(cpu_list, &local_list); | ||
3289 | local_irq_enable(); | ||
3290 | |||
3291 | while (!list_empty(&local_list)) { | ||
3292 | struct request *rq = list_entry(local_list.next, struct request, donelist); | ||
3293 | |||
3294 | list_del_init(&rq->donelist); | ||
3295 | rq->q->softirq_done_fn(rq); | ||
3296 | } | ||
3297 | } | ||
3298 | |||
3299 | #ifdef CONFIG_HOTPLUG_CPU | ||
3300 | |||
3301 | static int blk_cpu_notify(struct notifier_block *self, unsigned long action, | ||
3302 | void *hcpu) | ||
3303 | { | ||
3304 | /* | ||
3305 | * If a CPU goes away, splice its entries to the current CPU | ||
3306 | * and trigger a run of the softirq | ||
3307 | */ | ||
3308 | if (action == CPU_DEAD) { | ||
3309 | int cpu = (unsigned long) hcpu; | ||
3310 | |||
3311 | local_irq_disable(); | ||
3312 | list_splice_init(&per_cpu(blk_cpu_done, cpu), | ||
3313 | &__get_cpu_var(blk_cpu_done)); | ||
3314 | raise_softirq_irqoff(BLOCK_SOFTIRQ); | ||
3315 | local_irq_enable(); | ||
3316 | } | ||
3317 | |||
3318 | return NOTIFY_OK; | ||
3319 | } | ||
3320 | |||
3321 | |||
3322 | static struct notifier_block __devinitdata blk_cpu_notifier = { | ||
3323 | .notifier_call = blk_cpu_notify, | ||
3324 | }; | ||
3325 | |||
3326 | #endif /* CONFIG_HOTPLUG_CPU */ | ||
3327 | |||
3328 | /** | ||
3329 | * blk_complete_request - end I/O on a request | ||
3330 | * @req: the request being processed | ||
3331 | * | ||
3332 | * Description: | ||
3333 | * Ends all I/O on a request. It does not handle partial completions, | ||
3334 | * unless the driver actually implements this in its completionc callback | ||
3335 | * through requeueing. Theh actual completion happens out-of-order, | ||
3336 | * through a softirq handler. The user must have registered a completion | ||
3337 | * callback through blk_queue_softirq_done(). | ||
3338 | **/ | ||
3339 | |||
3340 | void blk_complete_request(struct request *req) | ||
3341 | { | ||
3342 | struct list_head *cpu_list; | ||
3343 | unsigned long flags; | ||
3344 | |||
3345 | BUG_ON(!req->q->softirq_done_fn); | ||
3346 | |||
3347 | local_irq_save(flags); | ||
3348 | |||
3349 | cpu_list = &__get_cpu_var(blk_cpu_done); | ||
3350 | list_add_tail(&req->donelist, cpu_list); | ||
3351 | raise_softirq_irqoff(BLOCK_SOFTIRQ); | ||
3352 | |||
3353 | local_irq_restore(flags); | ||
3354 | } | ||
3355 | |||
3356 | EXPORT_SYMBOL(blk_complete_request); | ||
3357 | |||
3358 | /* | ||
3290 | * queue lock must be held | 3359 | * queue lock must be held |
3291 | */ | 3360 | */ |
3292 | void end_that_request_last(struct request *req, int uptodate) | 3361 | void end_that_request_last(struct request *req, int uptodate) |
@@ -3364,6 +3433,8 @@ EXPORT_SYMBOL(kblockd_flush); | |||
3364 | 3433 | ||
3365 | int __init blk_dev_init(void) | 3434 | int __init blk_dev_init(void) |
3366 | { | 3435 | { |
3436 | int i; | ||
3437 | |||
3367 | kblockd_workqueue = create_workqueue("kblockd"); | 3438 | kblockd_workqueue = create_workqueue("kblockd"); |
3368 | if (!kblockd_workqueue) | 3439 | if (!kblockd_workqueue) |
3369 | panic("Failed to create kblockd\n"); | 3440 | panic("Failed to create kblockd\n"); |
@@ -3377,6 +3448,14 @@ int __init blk_dev_init(void) | |||
3377 | iocontext_cachep = kmem_cache_create("blkdev_ioc", | 3448 | iocontext_cachep = kmem_cache_create("blkdev_ioc", |
3378 | sizeof(struct io_context), 0, SLAB_PANIC, NULL, NULL); | 3449 | sizeof(struct io_context), 0, SLAB_PANIC, NULL, NULL); |
3379 | 3450 | ||
3451 | for (i = 0; i < NR_CPUS; i++) | ||
3452 | INIT_LIST_HEAD(&per_cpu(blk_cpu_done, i)); | ||
3453 | |||
3454 | open_softirq(BLOCK_SOFTIRQ, blk_done_softirq, NULL); | ||
3455 | #ifdef CONFIG_HOTPLUG_CPU | ||
3456 | register_cpu_notifier(&blk_cpu_notifier); | ||
3457 | #endif | ||
3458 | |||
3380 | blk_max_low_pfn = max_low_pfn; | 3459 | blk_max_low_pfn = max_low_pfn; |
3381 | blk_max_pfn = max_pfn; | 3460 | blk_max_pfn = max_pfn; |
3382 | 3461 | ||
diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c index c2ac36dfe4f3..18de84c8ccd8 100644 --- a/block/scsi_ioctl.c +++ b/block/scsi_ioctl.c | |||
@@ -190,16 +190,21 @@ static int verify_command(struct file *file, unsigned char *cmd) | |||
190 | safe_for_write(GPCMD_SET_STREAMING), | 190 | safe_for_write(GPCMD_SET_STREAMING), |
191 | }; | 191 | }; |
192 | unsigned char type = cmd_type[cmd[0]]; | 192 | unsigned char type = cmd_type[cmd[0]]; |
193 | int has_write_perm = 0; | ||
193 | 194 | ||
194 | /* Anybody who can open the device can do a read-safe command */ | 195 | /* Anybody who can open the device can do a read-safe command */ |
195 | if (type & CMD_READ_SAFE) | 196 | if (type & CMD_READ_SAFE) |
196 | return 0; | 197 | return 0; |
197 | 198 | ||
199 | /* | ||
200 | * file can be NULL from ioctl_by_bdev()... | ||
201 | */ | ||
202 | if (file) | ||
203 | has_write_perm = file->f_mode & FMODE_WRITE; | ||
204 | |||
198 | /* Write-safe commands just require a writable open.. */ | 205 | /* Write-safe commands just require a writable open.. */ |
199 | if (type & CMD_WRITE_SAFE) { | 206 | if ((type & CMD_WRITE_SAFE) && has_write_perm) |
200 | if (file->f_mode & FMODE_WRITE) | 207 | return 0; |
201 | return 0; | ||
202 | } | ||
203 | 208 | ||
204 | /* And root can do any command.. */ | 209 | /* And root can do any command.. */ |
205 | if (capable(CAP_SYS_RAWIO)) | 210 | if (capable(CAP_SYS_RAWIO)) |
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 88452c79fb64..e4e9f255bd1f 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -2178,16 +2178,48 @@ static inline void resend_cciss_cmd( ctlr_info_t *h, CommandList_struct *c) | |||
2178 | 2178 | ||
2179 | start_io(h); | 2179 | start_io(h); |
2180 | } | 2180 | } |
2181 | |||
2182 | static void cciss_softirq_done(struct request *rq) | ||
2183 | { | ||
2184 | CommandList_struct *cmd = rq->completion_data; | ||
2185 | ctlr_info_t *h = hba[cmd->ctlr]; | ||
2186 | u64bit temp64; | ||
2187 | int i, ddir; | ||
2188 | |||
2189 | if (cmd->Request.Type.Direction == XFER_READ) | ||
2190 | ddir = PCI_DMA_FROMDEVICE; | ||
2191 | else | ||
2192 | ddir = PCI_DMA_TODEVICE; | ||
2193 | |||
2194 | /* command did not need to be retried */ | ||
2195 | /* unmap the DMA mapping for all the scatter gather elements */ | ||
2196 | for(i=0; i<cmd->Header.SGList; i++) { | ||
2197 | temp64.val32.lower = cmd->SG[i].Addr.lower; | ||
2198 | temp64.val32.upper = cmd->SG[i].Addr.upper; | ||
2199 | pci_unmap_page(h->pdev, temp64.val, cmd->SG[i].Len, ddir); | ||
2200 | } | ||
2201 | |||
2202 | complete_buffers(rq->bio, rq->errors); | ||
2203 | |||
2204 | #ifdef CCISS_DEBUG | ||
2205 | printk("Done with %p\n", rq); | ||
2206 | #endif /* CCISS_DEBUG */ | ||
2207 | |||
2208 | spin_lock_irq(&h->lock); | ||
2209 | end_that_request_last(rq, rq->errors); | ||
2210 | cmd_free(h, cmd,1); | ||
2211 | spin_unlock_irq(&h->lock); | ||
2212 | } | ||
2213 | |||
2181 | /* checks the status of the job and calls complete buffers to mark all | 2214 | /* checks the status of the job and calls complete buffers to mark all |
2182 | * buffers for the completed job. | 2215 | * buffers for the completed job. Note that this function does not need |
2216 | * to hold the hba/queue lock. | ||
2183 | */ | 2217 | */ |
2184 | static inline void complete_command( ctlr_info_t *h, CommandList_struct *cmd, | 2218 | static inline void complete_command( ctlr_info_t *h, CommandList_struct *cmd, |
2185 | int timeout) | 2219 | int timeout) |
2186 | { | 2220 | { |
2187 | int status = 1; | 2221 | int status = 1; |
2188 | int i; | ||
2189 | int retry_cmd = 0; | 2222 | int retry_cmd = 0; |
2190 | u64bit temp64; | ||
2191 | 2223 | ||
2192 | if (timeout) | 2224 | if (timeout) |
2193 | status = 0; | 2225 | status = 0; |
@@ -2295,24 +2327,10 @@ static inline void complete_command( ctlr_info_t *h, CommandList_struct *cmd, | |||
2295 | resend_cciss_cmd(h,cmd); | 2327 | resend_cciss_cmd(h,cmd); |
2296 | return; | 2328 | return; |
2297 | } | 2329 | } |
2298 | /* command did not need to be retried */ | ||
2299 | /* unmap the DMA mapping for all the scatter gather elements */ | ||
2300 | for(i=0; i<cmd->Header.SGList; i++) { | ||
2301 | temp64.val32.lower = cmd->SG[i].Addr.lower; | ||
2302 | temp64.val32.upper = cmd->SG[i].Addr.upper; | ||
2303 | pci_unmap_page(hba[cmd->ctlr]->pdev, | ||
2304 | temp64.val, cmd->SG[i].Len, | ||
2305 | (cmd->Request.Type.Direction == XFER_READ) ? | ||
2306 | PCI_DMA_FROMDEVICE : PCI_DMA_TODEVICE); | ||
2307 | } | ||
2308 | complete_buffers(cmd->rq->bio, status); | ||
2309 | |||
2310 | #ifdef CCISS_DEBUG | ||
2311 | printk("Done with %p\n", cmd->rq); | ||
2312 | #endif /* CCISS_DEBUG */ | ||
2313 | 2330 | ||
2314 | end_that_request_last(cmd->rq, status ? 1 : -EIO); | 2331 | cmd->rq->completion_data = cmd; |
2315 | cmd_free(h,cmd,1); | 2332 | cmd->rq->errors = status; |
2333 | blk_complete_request(cmd->rq); | ||
2316 | } | 2334 | } |
2317 | 2335 | ||
2318 | /* | 2336 | /* |
@@ -3199,15 +3217,17 @@ static int __devinit cciss_init_one(struct pci_dev *pdev, | |||
3199 | drv->queue = q; | 3217 | drv->queue = q; |
3200 | 3218 | ||
3201 | q->backing_dev_info.ra_pages = READ_AHEAD; | 3219 | q->backing_dev_info.ra_pages = READ_AHEAD; |
3202 | blk_queue_bounce_limit(q, hba[i]->pdev->dma_mask); | 3220 | blk_queue_bounce_limit(q, hba[i]->pdev->dma_mask); |
3221 | |||
3222 | /* This is a hardware imposed limit. */ | ||
3223 | blk_queue_max_hw_segments(q, MAXSGENTRIES); | ||
3203 | 3224 | ||
3204 | /* This is a hardware imposed limit. */ | 3225 | /* This is a limit in the driver and could be eliminated. */ |
3205 | blk_queue_max_hw_segments(q, MAXSGENTRIES); | 3226 | blk_queue_max_phys_segments(q, MAXSGENTRIES); |
3206 | 3227 | ||
3207 | /* This is a limit in the driver and could be eliminated. */ | 3228 | blk_queue_max_sectors(q, 512); |
3208 | blk_queue_max_phys_segments(q, MAXSGENTRIES); | ||
3209 | 3229 | ||
3210 | blk_queue_max_sectors(q, 512); | 3230 | blk_queue_softirq_done(q, cciss_softirq_done); |
3211 | 3231 | ||
3212 | q->queuedata = hba[i]; | 3232 | q->queuedata = hba[i]; |
3213 | sprintf(disk->disk_name, "cciss/c%dd%d", i, j); | 3233 | sprintf(disk->disk_name, "cciss/c%dd%d", i, j); |
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index d31117eb95aa..e4d55ad32d2f 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
@@ -1332,8 +1332,6 @@ static ide_startstop_t cdrom_start_read (ide_drive_t *drive, unsigned int block) | |||
1332 | if (cdrom_read_from_buffer(drive)) | 1332 | if (cdrom_read_from_buffer(drive)) |
1333 | return ide_stopped; | 1333 | return ide_stopped; |
1334 | 1334 | ||
1335 | blk_attempt_remerge(drive->queue, rq); | ||
1336 | |||
1337 | /* Clear the local sector buffer. */ | 1335 | /* Clear the local sector buffer. */ |
1338 | info->nsectors_buffered = 0; | 1336 | info->nsectors_buffered = 0; |
1339 | 1337 | ||
@@ -1874,14 +1872,6 @@ static ide_startstop_t cdrom_start_write(ide_drive_t *drive, struct request *rq) | |||
1874 | return ide_stopped; | 1872 | return ide_stopped; |
1875 | } | 1873 | } |
1876 | 1874 | ||
1877 | /* | ||
1878 | * for dvd-ram and such media, it's a really big deal to get | ||
1879 | * big writes all the time. so scour the queue and attempt to | ||
1880 | * remerge requests, often the plugging will not have had time | ||
1881 | * to do this properly | ||
1882 | */ | ||
1883 | blk_attempt_remerge(drive->queue, rq); | ||
1884 | |||
1885 | info->nsectors_buffered = 0; | 1875 | info->nsectors_buffered = 0; |
1886 | 1876 | ||
1887 | /* use dma, if possible. we don't need to check more, since we | 1877 | /* use dma, if possible. we don't need to check more, since we |
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index b5dc6df8e67d..dea2d4dcc698 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c | |||
@@ -55,9 +55,22 @@ | |||
55 | #include <asm/io.h> | 55 | #include <asm/io.h> |
56 | #include <asm/bitops.h> | 56 | #include <asm/bitops.h> |
57 | 57 | ||
58 | void ide_softirq_done(struct request *rq) | ||
59 | { | ||
60 | request_queue_t *q = rq->q; | ||
61 | |||
62 | add_disk_randomness(rq->rq_disk); | ||
63 | end_that_request_chunk(rq, rq->errors, rq->data_len); | ||
64 | |||
65 | spin_lock_irq(q->queue_lock); | ||
66 | end_that_request_last(rq, rq->errors); | ||
67 | spin_unlock_irq(q->queue_lock); | ||
68 | } | ||
69 | |||
58 | int __ide_end_request(ide_drive_t *drive, struct request *rq, int uptodate, | 70 | int __ide_end_request(ide_drive_t *drive, struct request *rq, int uptodate, |
59 | int nr_sectors) | 71 | int nr_sectors) |
60 | { | 72 | { |
73 | unsigned int nbytes; | ||
61 | int ret = 1; | 74 | int ret = 1; |
62 | 75 | ||
63 | BUG_ON(!(rq->flags & REQ_STARTED)); | 76 | BUG_ON(!(rq->flags & REQ_STARTED)); |
@@ -81,17 +94,28 @@ int __ide_end_request(ide_drive_t *drive, struct request *rq, int uptodate, | |||
81 | HWGROUP(drive)->hwif->ide_dma_on(drive); | 94 | HWGROUP(drive)->hwif->ide_dma_on(drive); |
82 | } | 95 | } |
83 | 96 | ||
84 | if (!end_that_request_first(rq, uptodate, nr_sectors)) { | 97 | /* |
85 | add_disk_randomness(rq->rq_disk); | 98 | * For partial completions (or non fs/pc requests), use the regular |
86 | 99 | * direct completion path. | |
87 | if (blk_rq_tagged(rq)) | 100 | */ |
88 | blk_queue_end_tag(drive->queue, rq); | 101 | nbytes = nr_sectors << 9; |
89 | 102 | if (rq_all_done(rq, nbytes)) { | |
103 | rq->errors = uptodate; | ||
104 | rq->data_len = nbytes; | ||
90 | blkdev_dequeue_request(rq); | 105 | blkdev_dequeue_request(rq); |
91 | HWGROUP(drive)->rq = NULL; | 106 | HWGROUP(drive)->rq = NULL; |
92 | end_that_request_last(rq, uptodate); | 107 | blk_complete_request(rq); |
93 | ret = 0; | 108 | ret = 0; |
109 | } else { | ||
110 | if (!end_that_request_first(rq, uptodate, nr_sectors)) { | ||
111 | add_disk_randomness(rq->rq_disk); | ||
112 | blkdev_dequeue_request(rq); | ||
113 | HWGROUP(drive)->rq = NULL; | ||
114 | end_that_request_last(rq, uptodate); | ||
115 | ret = 0; | ||
116 | } | ||
94 | } | 117 | } |
118 | |||
95 | return ret; | 119 | return ret; |
96 | } | 120 | } |
97 | EXPORT_SYMBOL(__ide_end_request); | 121 | EXPORT_SYMBOL(__ide_end_request); |
@@ -113,6 +137,10 @@ int ide_end_request (ide_drive_t *drive, int uptodate, int nr_sectors) | |||
113 | unsigned long flags; | 137 | unsigned long flags; |
114 | int ret = 1; | 138 | int ret = 1; |
115 | 139 | ||
140 | /* | ||
141 | * room for locking improvements here, the calls below don't | ||
142 | * need the queue lock held at all | ||
143 | */ | ||
116 | spin_lock_irqsave(&ide_lock, flags); | 144 | spin_lock_irqsave(&ide_lock, flags); |
117 | rq = HWGROUP(drive)->rq; | 145 | rq = HWGROUP(drive)->rq; |
118 | 146 | ||
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index 02167a5b751d..1ddaa71a8f45 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c | |||
@@ -1011,6 +1011,8 @@ static int ide_init_queue(ide_drive_t *drive) | |||
1011 | blk_queue_max_hw_segments(q, max_sg_entries); | 1011 | blk_queue_max_hw_segments(q, max_sg_entries); |
1012 | blk_queue_max_phys_segments(q, max_sg_entries); | 1012 | blk_queue_max_phys_segments(q, max_sg_entries); |
1013 | 1013 | ||
1014 | blk_queue_softirq_done(q, ide_softirq_done); | ||
1015 | |||
1014 | /* assign drive queue */ | 1016 | /* assign drive queue */ |
1015 | drive->queue = q; | 1017 | drive->queue = q; |
1016 | 1018 | ||
diff --git a/drivers/net/3c503.c b/drivers/net/3c503.c index 5c5eebdb6914..dcc98afa65d7 100644 --- a/drivers/net/3c503.c +++ b/drivers/net/3c503.c | |||
@@ -148,14 +148,6 @@ el2_pio_probe(struct net_device *dev) | |||
148 | return -ENODEV; | 148 | return -ENODEV; |
149 | } | 149 | } |
150 | 150 | ||
151 | static void cleanup_card(struct net_device *dev) | ||
152 | { | ||
153 | /* NB: el2_close() handles free_irq */ | ||
154 | release_region(dev->base_addr, EL2_IO_EXTENT); | ||
155 | if (ei_status.mem) | ||
156 | iounmap(ei_status.mem); | ||
157 | } | ||
158 | |||
159 | #ifndef MODULE | 151 | #ifndef MODULE |
160 | struct net_device * __init el2_probe(int unit) | 152 | struct net_device * __init el2_probe(int unit) |
161 | { | 153 | { |
@@ -726,6 +718,14 @@ init_module(void) | |||
726 | return -ENXIO; | 718 | return -ENXIO; |
727 | } | 719 | } |
728 | 720 | ||
721 | static void cleanup_card(struct net_device *dev) | ||
722 | { | ||
723 | /* NB: el2_close() handles free_irq */ | ||
724 | release_region(dev->base_addr, EL2_IO_EXTENT); | ||
725 | if (ei_status.mem) | ||
726 | iounmap(ei_status.mem); | ||
727 | } | ||
728 | |||
729 | void | 729 | void |
730 | cleanup_module(void) | 730 | cleanup_module(void) |
731 | { | 731 | { |
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 1960961bf28e..733bc25b2bf9 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -129,7 +129,7 @@ config NET_SB1000 | |||
129 | 129 | ||
130 | If you don't have this card, of course say N. | 130 | If you don't have this card, of course say N. |
131 | 131 | ||
132 | source "drivers/net/arcnet/Kconfig" | 132 | source "drivers/net/arcnet/Kconfig" |
133 | 133 | ||
134 | source "drivers/net/phy/Kconfig" | 134 | source "drivers/net/phy/Kconfig" |
135 | 135 | ||
@@ -844,7 +844,7 @@ config SMC9194 | |||
844 | 844 | ||
845 | config DM9000 | 845 | config DM9000 |
846 | tristate "DM9000 support" | 846 | tristate "DM9000 support" |
847 | depends on ARM && NET_ETHERNET | 847 | depends on (ARM || MIPS) && NET_ETHERNET |
848 | select CRC32 | 848 | select CRC32 |
849 | select MII | 849 | select MII |
850 | ---help--- | 850 | ---help--- |
diff --git a/drivers/net/ac3200.c b/drivers/net/ac3200.c index 8a0af5453e21..7952dc6d77e3 100644 --- a/drivers/net/ac3200.c +++ b/drivers/net/ac3200.c | |||
@@ -123,14 +123,6 @@ static int __init do_ac3200_probe(struct net_device *dev) | |||
123 | return -ENODEV; | 123 | return -ENODEV; |
124 | } | 124 | } |
125 | 125 | ||
126 | static void cleanup_card(struct net_device *dev) | ||
127 | { | ||
128 | /* Someday free_irq may be in ac_close_card() */ | ||
129 | free_irq(dev->irq, dev); | ||
130 | release_region(dev->base_addr, AC_IO_EXTENT); | ||
131 | iounmap(ei_status.mem); | ||
132 | } | ||
133 | |||
134 | #ifndef MODULE | 126 | #ifndef MODULE |
135 | struct net_device * __init ac3200_probe(int unit) | 127 | struct net_device * __init ac3200_probe(int unit) |
136 | { | 128 | { |
@@ -406,6 +398,14 @@ init_module(void) | |||
406 | return -ENXIO; | 398 | return -ENXIO; |
407 | } | 399 | } |
408 | 400 | ||
401 | static void cleanup_card(struct net_device *dev) | ||
402 | { | ||
403 | /* Someday free_irq may be in ac_close_card() */ | ||
404 | free_irq(dev->irq, dev); | ||
405 | release_region(dev->base_addr, AC_IO_EXTENT); | ||
406 | iounmap(ei_status.mem); | ||
407 | } | ||
408 | |||
409 | void | 409 | void |
410 | cleanup_module(void) | 410 | cleanup_module(void) |
411 | { | 411 | { |
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h index 015c7f1d1bc0..f20bb85c1ea5 100644 --- a/drivers/net/bonding/bonding.h +++ b/drivers/net/bonding/bonding.h | |||
@@ -205,7 +205,7 @@ struct bonding { | |||
205 | * | 205 | * |
206 | * Caller must hold bond lock for read | 206 | * Caller must hold bond lock for read |
207 | */ | 207 | */ |
208 | extern inline struct slave *bond_get_slave_by_dev(struct bonding *bond, struct net_device *slave_dev) | 208 | static inline struct slave *bond_get_slave_by_dev(struct bonding *bond, struct net_device *slave_dev) |
209 | { | 209 | { |
210 | struct slave *slave = NULL; | 210 | struct slave *slave = NULL; |
211 | int i; | 211 | int i; |
@@ -219,7 +219,7 @@ extern inline struct slave *bond_get_slave_by_dev(struct bonding *bond, struct n | |||
219 | return slave; | 219 | return slave; |
220 | } | 220 | } |
221 | 221 | ||
222 | extern inline struct bonding *bond_get_bond_by_slave(struct slave *slave) | 222 | static inline struct bonding *bond_get_bond_by_slave(struct slave *slave) |
223 | { | 223 | { |
224 | if (!slave || !slave->dev->master) { | 224 | if (!slave || !slave->dev->master) { |
225 | return NULL; | 225 | return NULL; |
@@ -228,13 +228,13 @@ extern inline struct bonding *bond_get_bond_by_slave(struct slave *slave) | |||
228 | return (struct bonding *)slave->dev->master->priv; | 228 | return (struct bonding *)slave->dev->master->priv; |
229 | } | 229 | } |
230 | 230 | ||
231 | extern inline void bond_set_slave_inactive_flags(struct slave *slave) | 231 | static inline void bond_set_slave_inactive_flags(struct slave *slave) |
232 | { | 232 | { |
233 | slave->state = BOND_STATE_BACKUP; | 233 | slave->state = BOND_STATE_BACKUP; |
234 | slave->dev->flags |= IFF_NOARP; | 234 | slave->dev->flags |= IFF_NOARP; |
235 | } | 235 | } |
236 | 236 | ||
237 | extern inline void bond_set_slave_active_flags(struct slave *slave) | 237 | static inline void bond_set_slave_active_flags(struct slave *slave) |
238 | { | 238 | { |
239 | slave->state = BOND_STATE_ACTIVE; | 239 | slave->state = BOND_STATE_ACTIVE; |
240 | slave->dev->flags &= ~IFF_NOARP; | 240 | slave->dev->flags &= ~IFF_NOARP; |
diff --git a/drivers/net/e1000/e1000_param.c b/drivers/net/e1000/e1000_param.c index 38695d5b4637..ccbbe5ad8e0f 100644 --- a/drivers/net/e1000/e1000_param.c +++ b/drivers/net/e1000/e1000_param.c | |||
@@ -545,7 +545,7 @@ e1000_check_fiber_options(struct e1000_adapter *adapter) | |||
545 | static void __devinit | 545 | static void __devinit |
546 | e1000_check_copper_options(struct e1000_adapter *adapter) | 546 | e1000_check_copper_options(struct e1000_adapter *adapter) |
547 | { | 547 | { |
548 | int speed, dplx; | 548 | int speed, dplx, an; |
549 | int bd = adapter->bd_number; | 549 | int bd = adapter->bd_number; |
550 | 550 | ||
551 | { /* Speed */ | 551 | { /* Speed */ |
@@ -641,8 +641,12 @@ e1000_check_copper_options(struct e1000_adapter *adapter) | |||
641 | .p = an_list }} | 641 | .p = an_list }} |
642 | }; | 642 | }; |
643 | 643 | ||
644 | int an = AutoNeg[bd]; | 644 | if (num_AutoNeg > bd) { |
645 | e1000_validate_option(&an, &opt, adapter); | 645 | an = AutoNeg[bd]; |
646 | e1000_validate_option(&an, &opt, adapter); | ||
647 | } else { | ||
648 | an = opt.def; | ||
649 | } | ||
646 | adapter->hw.autoneg_advertised = an; | 650 | adapter->hw.autoneg_advertised = an; |
647 | } | 651 | } |
648 | 652 | ||
diff --git a/drivers/net/e2100.c b/drivers/net/e2100.c index f5a4dd7d8564..e5c5cd2a2712 100644 --- a/drivers/net/e2100.c +++ b/drivers/net/e2100.c | |||
@@ -140,13 +140,6 @@ static int __init do_e2100_probe(struct net_device *dev) | |||
140 | return -ENODEV; | 140 | return -ENODEV; |
141 | } | 141 | } |
142 | 142 | ||
143 | static void cleanup_card(struct net_device *dev) | ||
144 | { | ||
145 | /* NB: e21_close() handles free_irq */ | ||
146 | iounmap(ei_status.mem); | ||
147 | release_region(dev->base_addr, E21_IO_EXTENT); | ||
148 | } | ||
149 | |||
150 | #ifndef MODULE | 143 | #ifndef MODULE |
151 | struct net_device * __init e2100_probe(int unit) | 144 | struct net_device * __init e2100_probe(int unit) |
152 | { | 145 | { |
@@ -463,6 +456,13 @@ init_module(void) | |||
463 | return -ENXIO; | 456 | return -ENXIO; |
464 | } | 457 | } |
465 | 458 | ||
459 | static void cleanup_card(struct net_device *dev) | ||
460 | { | ||
461 | /* NB: e21_close() handles free_irq */ | ||
462 | iounmap(ei_status.mem); | ||
463 | release_region(dev->base_addr, E21_IO_EXTENT); | ||
464 | } | ||
465 | |||
466 | void | 466 | void |
467 | cleanup_module(void) | 467 | cleanup_module(void) |
468 | { | 468 | { |
diff --git a/drivers/net/es3210.c b/drivers/net/es3210.c index 50f8e23bb9e5..6b0ab1eac3fb 100644 --- a/drivers/net/es3210.c +++ b/drivers/net/es3210.c | |||
@@ -155,13 +155,6 @@ static int __init do_es_probe(struct net_device *dev) | |||
155 | return -ENODEV; | 155 | return -ENODEV; |
156 | } | 156 | } |
157 | 157 | ||
158 | static void cleanup_card(struct net_device *dev) | ||
159 | { | ||
160 | free_irq(dev->irq, dev); | ||
161 | release_region(dev->base_addr, ES_IO_EXTENT); | ||
162 | iounmap(ei_status.mem); | ||
163 | } | ||
164 | |||
165 | #ifndef MODULE | 158 | #ifndef MODULE |
166 | struct net_device * __init es_probe(int unit) | 159 | struct net_device * __init es_probe(int unit) |
167 | { | 160 | { |
@@ -456,6 +449,13 @@ init_module(void) | |||
456 | return -ENXIO; | 449 | return -ENXIO; |
457 | } | 450 | } |
458 | 451 | ||
452 | static void cleanup_card(struct net_device *dev) | ||
453 | { | ||
454 | free_irq(dev->irq, dev); | ||
455 | release_region(dev->base_addr, ES_IO_EXTENT); | ||
456 | iounmap(ei_status.mem); | ||
457 | } | ||
458 | |||
459 | void | 459 | void |
460 | cleanup_module(void) | 460 | cleanup_module(void) |
461 | { | 461 | { |
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c index c39344adecce..3682ec61e8a8 100644 --- a/drivers/net/forcedeth.c +++ b/drivers/net/forcedeth.c | |||
@@ -101,6 +101,7 @@ | |||
101 | * 0.46: 20 Oct 2005: Add irq optimization modes. | 101 | * 0.46: 20 Oct 2005: Add irq optimization modes. |
102 | * 0.47: 26 Oct 2005: Add phyaddr 0 in phy scan. | 102 | * 0.47: 26 Oct 2005: Add phyaddr 0 in phy scan. |
103 | * 0.48: 24 Dec 2005: Disable TSO, bugfix for pci_map_single | 103 | * 0.48: 24 Dec 2005: Disable TSO, bugfix for pci_map_single |
104 | * 0.49: 10 Dec 2005: Fix tso for large buffers. | ||
104 | * | 105 | * |
105 | * Known bugs: | 106 | * Known bugs: |
106 | * We suspect that on some hardware no TX done interrupts are generated. | 107 | * We suspect that on some hardware no TX done interrupts are generated. |
@@ -112,7 +113,7 @@ | |||
112 | * DEV_NEED_TIMERIRQ will not harm you on sane hardware, only generating a few | 113 | * DEV_NEED_TIMERIRQ will not harm you on sane hardware, only generating a few |
113 | * superfluous timer interrupts from the nic. | 114 | * superfluous timer interrupts from the nic. |
114 | */ | 115 | */ |
115 | #define FORCEDETH_VERSION "0.48" | 116 | #define FORCEDETH_VERSION "0.49" |
116 | #define DRV_NAME "forcedeth" | 117 | #define DRV_NAME "forcedeth" |
117 | 118 | ||
118 | #include <linux/module.h> | 119 | #include <linux/module.h> |
@@ -349,6 +350,8 @@ typedef union _ring_type { | |||
349 | #define NV_TX2_VALID (1<<31) | 350 | #define NV_TX2_VALID (1<<31) |
350 | #define NV_TX2_TSO (1<<28) | 351 | #define NV_TX2_TSO (1<<28) |
351 | #define NV_TX2_TSO_SHIFT 14 | 352 | #define NV_TX2_TSO_SHIFT 14 |
353 | #define NV_TX2_TSO_MAX_SHIFT 14 | ||
354 | #define NV_TX2_TSO_MAX_SIZE (1<<NV_TX2_TSO_MAX_SHIFT) | ||
352 | #define NV_TX2_CHECKSUM_L3 (1<<27) | 355 | #define NV_TX2_CHECKSUM_L3 (1<<27) |
353 | #define NV_TX2_CHECKSUM_L4 (1<<26) | 356 | #define NV_TX2_CHECKSUM_L4 (1<<26) |
354 | 357 | ||
@@ -408,15 +411,15 @@ typedef union _ring_type { | |||
408 | #define NV_WATCHDOG_TIMEO (5*HZ) | 411 | #define NV_WATCHDOG_TIMEO (5*HZ) |
409 | 412 | ||
410 | #define RX_RING 128 | 413 | #define RX_RING 128 |
411 | #define TX_RING 64 | 414 | #define TX_RING 256 |
412 | /* | 415 | /* |
413 | * If your nic mysteriously hangs then try to reduce the limits | 416 | * If your nic mysteriously hangs then try to reduce the limits |
414 | * to 1/0: It might be required to set NV_TX_LASTPACKET in the | 417 | * to 1/0: It might be required to set NV_TX_LASTPACKET in the |
415 | * last valid ring entry. But this would be impossible to | 418 | * last valid ring entry. But this would be impossible to |
416 | * implement - probably a disassembly error. | 419 | * implement - probably a disassembly error. |
417 | */ | 420 | */ |
418 | #define TX_LIMIT_STOP 63 | 421 | #define TX_LIMIT_STOP 255 |
419 | #define TX_LIMIT_START 62 | 422 | #define TX_LIMIT_START 254 |
420 | 423 | ||
421 | /* rx/tx mac addr + type + vlan + align + slack*/ | 424 | /* rx/tx mac addr + type + vlan + align + slack*/ |
422 | #define NV_RX_HEADERS (64) | 425 | #define NV_RX_HEADERS (64) |
@@ -535,6 +538,7 @@ struct fe_priv { | |||
535 | unsigned int next_tx, nic_tx; | 538 | unsigned int next_tx, nic_tx; |
536 | struct sk_buff *tx_skbuff[TX_RING]; | 539 | struct sk_buff *tx_skbuff[TX_RING]; |
537 | dma_addr_t tx_dma[TX_RING]; | 540 | dma_addr_t tx_dma[TX_RING]; |
541 | unsigned int tx_dma_len[TX_RING]; | ||
538 | u32 tx_flags; | 542 | u32 tx_flags; |
539 | }; | 543 | }; |
540 | 544 | ||
@@ -935,6 +939,7 @@ static void nv_init_tx(struct net_device *dev) | |||
935 | else | 939 | else |
936 | np->tx_ring.ex[i].FlagLen = 0; | 940 | np->tx_ring.ex[i].FlagLen = 0; |
937 | np->tx_skbuff[i] = NULL; | 941 | np->tx_skbuff[i] = NULL; |
942 | np->tx_dma[i] = 0; | ||
938 | } | 943 | } |
939 | } | 944 | } |
940 | 945 | ||
@@ -945,30 +950,27 @@ static int nv_init_ring(struct net_device *dev) | |||
945 | return nv_alloc_rx(dev); | 950 | return nv_alloc_rx(dev); |
946 | } | 951 | } |
947 | 952 | ||
948 | static void nv_release_txskb(struct net_device *dev, unsigned int skbnr) | 953 | static int nv_release_txskb(struct net_device *dev, unsigned int skbnr) |
949 | { | 954 | { |
950 | struct fe_priv *np = netdev_priv(dev); | 955 | struct fe_priv *np = netdev_priv(dev); |
951 | struct sk_buff *skb = np->tx_skbuff[skbnr]; | 956 | |
952 | unsigned int j, entry, fragments; | 957 | dprintk(KERN_INFO "%s: nv_release_txskb for skbnr %d\n", |
953 | 958 | dev->name, skbnr); | |
954 | dprintk(KERN_INFO "%s: nv_release_txskb for skbnr %d, skb %p\n", | 959 | |
955 | dev->name, skbnr, np->tx_skbuff[skbnr]); | 960 | if (np->tx_dma[skbnr]) { |
956 | 961 | pci_unmap_page(np->pci_dev, np->tx_dma[skbnr], | |
957 | entry = skbnr; | 962 | np->tx_dma_len[skbnr], |
958 | if ((fragments = skb_shinfo(skb)->nr_frags) != 0) { | 963 | PCI_DMA_TODEVICE); |
959 | for (j = fragments; j >= 1; j--) { | 964 | np->tx_dma[skbnr] = 0; |
960 | skb_frag_t *frag = &skb_shinfo(skb)->frags[j-1]; | 965 | } |
961 | pci_unmap_page(np->pci_dev, np->tx_dma[entry], | 966 | |
962 | frag->size, | 967 | if (np->tx_skbuff[skbnr]) { |
963 | PCI_DMA_TODEVICE); | 968 | dev_kfree_skb_irq(np->tx_skbuff[skbnr]); |
964 | entry = (entry - 1) % TX_RING; | 969 | np->tx_skbuff[skbnr] = NULL; |
965 | } | 970 | return 1; |
971 | } else { | ||
972 | return 0; | ||
966 | } | 973 | } |
967 | pci_unmap_single(np->pci_dev, np->tx_dma[entry], | ||
968 | skb->len - skb->data_len, | ||
969 | PCI_DMA_TODEVICE); | ||
970 | dev_kfree_skb_irq(skb); | ||
971 | np->tx_skbuff[skbnr] = NULL; | ||
972 | } | 974 | } |
973 | 975 | ||
974 | static void nv_drain_tx(struct net_device *dev) | 976 | static void nv_drain_tx(struct net_device *dev) |
@@ -981,10 +983,8 @@ static void nv_drain_tx(struct net_device *dev) | |||
981 | np->tx_ring.orig[i].FlagLen = 0; | 983 | np->tx_ring.orig[i].FlagLen = 0; |
982 | else | 984 | else |
983 | np->tx_ring.ex[i].FlagLen = 0; | 985 | np->tx_ring.ex[i].FlagLen = 0; |
984 | if (np->tx_skbuff[i]) { | 986 | if (nv_release_txskb(dev, i)) |
985 | nv_release_txskb(dev, i); | ||
986 | np->stats.tx_dropped++; | 987 | np->stats.tx_dropped++; |
987 | } | ||
988 | } | 988 | } |
989 | } | 989 | } |
990 | 990 | ||
@@ -1021,68 +1021,105 @@ static void drain_ring(struct net_device *dev) | |||
1021 | static int nv_start_xmit(struct sk_buff *skb, struct net_device *dev) | 1021 | static int nv_start_xmit(struct sk_buff *skb, struct net_device *dev) |
1022 | { | 1022 | { |
1023 | struct fe_priv *np = netdev_priv(dev); | 1023 | struct fe_priv *np = netdev_priv(dev); |
1024 | u32 tx_flags = 0; | ||
1024 | u32 tx_flags_extra = (np->desc_ver == DESC_VER_1 ? NV_TX_LASTPACKET : NV_TX2_LASTPACKET); | 1025 | u32 tx_flags_extra = (np->desc_ver == DESC_VER_1 ? NV_TX_LASTPACKET : NV_TX2_LASTPACKET); |
1025 | unsigned int fragments = skb_shinfo(skb)->nr_frags; | 1026 | unsigned int fragments = skb_shinfo(skb)->nr_frags; |
1026 | unsigned int nr = (np->next_tx + fragments) % TX_RING; | 1027 | unsigned int nr = (np->next_tx - 1) % TX_RING; |
1028 | unsigned int start_nr = np->next_tx % TX_RING; | ||
1027 | unsigned int i; | 1029 | unsigned int i; |
1030 | u32 offset = 0; | ||
1031 | u32 bcnt; | ||
1032 | u32 size = skb->len-skb->data_len; | ||
1033 | u32 entries = (size >> NV_TX2_TSO_MAX_SHIFT) + ((size & (NV_TX2_TSO_MAX_SIZE-1)) ? 1 : 0); | ||
1034 | |||
1035 | /* add fragments to entries count */ | ||
1036 | for (i = 0; i < fragments; i++) { | ||
1037 | entries += (skb_shinfo(skb)->frags[i].size >> NV_TX2_TSO_MAX_SHIFT) + | ||
1038 | ((skb_shinfo(skb)->frags[i].size & (NV_TX2_TSO_MAX_SIZE-1)) ? 1 : 0); | ||
1039 | } | ||
1028 | 1040 | ||
1029 | spin_lock_irq(&np->lock); | 1041 | spin_lock_irq(&np->lock); |
1030 | 1042 | ||
1031 | if ((np->next_tx - np->nic_tx + fragments) > TX_LIMIT_STOP) { | 1043 | if ((np->next_tx - np->nic_tx + entries - 1) > TX_LIMIT_STOP) { |
1032 | spin_unlock_irq(&np->lock); | 1044 | spin_unlock_irq(&np->lock); |
1033 | netif_stop_queue(dev); | 1045 | netif_stop_queue(dev); |
1034 | return NETDEV_TX_BUSY; | 1046 | return NETDEV_TX_BUSY; |
1035 | } | 1047 | } |
1036 | 1048 | ||
1037 | np->tx_skbuff[nr] = skb; | 1049 | /* setup the header buffer */ |
1038 | 1050 | do { | |
1039 | if (fragments) { | 1051 | bcnt = (size > NV_TX2_TSO_MAX_SIZE) ? NV_TX2_TSO_MAX_SIZE : size; |
1040 | dprintk(KERN_DEBUG "%s: nv_start_xmit: buffer contains %d fragments\n", dev->name, fragments); | 1052 | nr = (nr + 1) % TX_RING; |
1041 | /* setup descriptors in reverse order */ | 1053 | |
1042 | for (i = fragments; i >= 1; i--) { | 1054 | np->tx_dma[nr] = pci_map_single(np->pci_dev, skb->data + offset, bcnt, |
1043 | skb_frag_t *frag = &skb_shinfo(skb)->frags[i-1]; | 1055 | PCI_DMA_TODEVICE); |
1044 | np->tx_dma[nr] = pci_map_page(np->pci_dev, frag->page, frag->page_offset, frag->size, | 1056 | np->tx_dma_len[nr] = bcnt; |
1045 | PCI_DMA_TODEVICE); | 1057 | |
1058 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { | ||
1059 | np->tx_ring.orig[nr].PacketBuffer = cpu_to_le32(np->tx_dma[nr]); | ||
1060 | np->tx_ring.orig[nr].FlagLen = cpu_to_le32((bcnt-1) | tx_flags); | ||
1061 | } else { | ||
1062 | np->tx_ring.ex[nr].PacketBufferHigh = cpu_to_le64(np->tx_dma[nr]) >> 32; | ||
1063 | np->tx_ring.ex[nr].PacketBufferLow = cpu_to_le64(np->tx_dma[nr]) & 0x0FFFFFFFF; | ||
1064 | np->tx_ring.ex[nr].FlagLen = cpu_to_le32((bcnt-1) | tx_flags); | ||
1065 | } | ||
1066 | tx_flags = np->tx_flags; | ||
1067 | offset += bcnt; | ||
1068 | size -= bcnt; | ||
1069 | } while(size); | ||
1070 | |||
1071 | /* setup the fragments */ | ||
1072 | for (i = 0; i < fragments; i++) { | ||
1073 | skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; | ||
1074 | u32 size = frag->size; | ||
1075 | offset = 0; | ||
1076 | |||
1077 | do { | ||
1078 | bcnt = (size > NV_TX2_TSO_MAX_SIZE) ? NV_TX2_TSO_MAX_SIZE : size; | ||
1079 | nr = (nr + 1) % TX_RING; | ||
1080 | |||
1081 | np->tx_dma[nr] = pci_map_page(np->pci_dev, frag->page, frag->page_offset+offset, bcnt, | ||
1082 | PCI_DMA_TODEVICE); | ||
1083 | np->tx_dma_len[nr] = bcnt; | ||
1046 | 1084 | ||
1047 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { | 1085 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { |
1048 | np->tx_ring.orig[nr].PacketBuffer = cpu_to_le32(np->tx_dma[nr]); | 1086 | np->tx_ring.orig[nr].PacketBuffer = cpu_to_le32(np->tx_dma[nr]); |
1049 | np->tx_ring.orig[nr].FlagLen = cpu_to_le32( (frag->size-1) | np->tx_flags | tx_flags_extra); | 1087 | np->tx_ring.orig[nr].FlagLen = cpu_to_le32((bcnt-1) | tx_flags); |
1050 | } else { | 1088 | } else { |
1051 | np->tx_ring.ex[nr].PacketBufferHigh = cpu_to_le64(np->tx_dma[nr]) >> 32; | 1089 | np->tx_ring.ex[nr].PacketBufferHigh = cpu_to_le64(np->tx_dma[nr]) >> 32; |
1052 | np->tx_ring.ex[nr].PacketBufferLow = cpu_to_le64(np->tx_dma[nr]) & 0x0FFFFFFFF; | 1090 | np->tx_ring.ex[nr].PacketBufferLow = cpu_to_le64(np->tx_dma[nr]) & 0x0FFFFFFFF; |
1053 | np->tx_ring.ex[nr].FlagLen = cpu_to_le32( (frag->size-1) | np->tx_flags | tx_flags_extra); | 1091 | np->tx_ring.ex[nr].FlagLen = cpu_to_le32((bcnt-1) | tx_flags); |
1054 | } | 1092 | } |
1055 | 1093 | offset += bcnt; | |
1056 | nr = (nr - 1) % TX_RING; | 1094 | size -= bcnt; |
1095 | } while (size); | ||
1096 | } | ||
1057 | 1097 | ||
1058 | if (np->desc_ver == DESC_VER_1) | 1098 | /* set last fragment flag */ |
1059 | tx_flags_extra &= ~NV_TX_LASTPACKET; | 1099 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { |
1060 | else | 1100 | np->tx_ring.orig[nr].FlagLen |= cpu_to_le32(tx_flags_extra); |
1061 | tx_flags_extra &= ~NV_TX2_LASTPACKET; | 1101 | } else { |
1062 | } | 1102 | np->tx_ring.ex[nr].FlagLen |= cpu_to_le32(tx_flags_extra); |
1063 | } | 1103 | } |
1064 | 1104 | ||
1105 | np->tx_skbuff[nr] = skb; | ||
1106 | |||
1065 | #ifdef NETIF_F_TSO | 1107 | #ifdef NETIF_F_TSO |
1066 | if (skb_shinfo(skb)->tso_size) | 1108 | if (skb_shinfo(skb)->tso_size) |
1067 | tx_flags_extra |= NV_TX2_TSO | (skb_shinfo(skb)->tso_size << NV_TX2_TSO_SHIFT); | 1109 | tx_flags_extra = NV_TX2_TSO | (skb_shinfo(skb)->tso_size << NV_TX2_TSO_SHIFT); |
1068 | else | 1110 | else |
1069 | #endif | 1111 | #endif |
1070 | tx_flags_extra |= (skb->ip_summed == CHECKSUM_HW ? (NV_TX2_CHECKSUM_L3|NV_TX2_CHECKSUM_L4) : 0); | 1112 | tx_flags_extra = (skb->ip_summed == CHECKSUM_HW ? (NV_TX2_CHECKSUM_L3|NV_TX2_CHECKSUM_L4) : 0); |
1071 | 1113 | ||
1072 | np->tx_dma[nr] = pci_map_single(np->pci_dev, skb->data, skb->len-skb->data_len, | 1114 | /* set tx flags */ |
1073 | PCI_DMA_TODEVICE); | ||
1074 | |||
1075 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { | 1115 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { |
1076 | np->tx_ring.orig[nr].PacketBuffer = cpu_to_le32(np->tx_dma[nr]); | 1116 | np->tx_ring.orig[start_nr].FlagLen |= cpu_to_le32(tx_flags | tx_flags_extra); |
1077 | np->tx_ring.orig[nr].FlagLen = cpu_to_le32( (skb->len-skb->data_len-1) | np->tx_flags | tx_flags_extra); | ||
1078 | } else { | 1117 | } else { |
1079 | np->tx_ring.ex[nr].PacketBufferHigh = cpu_to_le64(np->tx_dma[nr]) >> 32; | 1118 | np->tx_ring.ex[start_nr].FlagLen |= cpu_to_le32(tx_flags | tx_flags_extra); |
1080 | np->tx_ring.ex[nr].PacketBufferLow = cpu_to_le64(np->tx_dma[nr]) & 0x0FFFFFFFF; | ||
1081 | np->tx_ring.ex[nr].FlagLen = cpu_to_le32( (skb->len-skb->data_len-1) | np->tx_flags | tx_flags_extra); | ||
1082 | } | 1119 | } |
1083 | 1120 | ||
1084 | dprintk(KERN_DEBUG "%s: nv_start_xmit: packet packet %d queued for transmission. tx_flags_extra: %x\n", | 1121 | dprintk(KERN_DEBUG "%s: nv_start_xmit: packet %d (entries %d) queued for transmission. tx_flags_extra: %x\n", |
1085 | dev->name, np->next_tx, tx_flags_extra); | 1122 | dev->name, np->next_tx, entries, tx_flags_extra); |
1086 | { | 1123 | { |
1087 | int j; | 1124 | int j; |
1088 | for (j=0; j<64; j++) { | 1125 | for (j=0; j<64; j++) { |
@@ -1093,7 +1130,7 @@ static int nv_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1093 | dprintk("\n"); | 1130 | dprintk("\n"); |
1094 | } | 1131 | } |
1095 | 1132 | ||
1096 | np->next_tx += 1 + fragments; | 1133 | np->next_tx += entries; |
1097 | 1134 | ||
1098 | dev->trans_start = jiffies; | 1135 | dev->trans_start = jiffies; |
1099 | spin_unlock_irq(&np->lock); | 1136 | spin_unlock_irq(&np->lock); |
@@ -1140,7 +1177,6 @@ static void nv_tx_done(struct net_device *dev) | |||
1140 | np->stats.tx_packets++; | 1177 | np->stats.tx_packets++; |
1141 | np->stats.tx_bytes += skb->len; | 1178 | np->stats.tx_bytes += skb->len; |
1142 | } | 1179 | } |
1143 | nv_release_txskb(dev, i); | ||
1144 | } | 1180 | } |
1145 | } else { | 1181 | } else { |
1146 | if (Flags & NV_TX2_LASTPACKET) { | 1182 | if (Flags & NV_TX2_LASTPACKET) { |
@@ -1156,9 +1192,9 @@ static void nv_tx_done(struct net_device *dev) | |||
1156 | np->stats.tx_packets++; | 1192 | np->stats.tx_packets++; |
1157 | np->stats.tx_bytes += skb->len; | 1193 | np->stats.tx_bytes += skb->len; |
1158 | } | 1194 | } |
1159 | nv_release_txskb(dev, i); | ||
1160 | } | 1195 | } |
1161 | } | 1196 | } |
1197 | nv_release_txskb(dev, i); | ||
1162 | np->nic_tx++; | 1198 | np->nic_tx++; |
1163 | } | 1199 | } |
1164 | if (np->next_tx - np->nic_tx < TX_LIMIT_START) | 1200 | if (np->next_tx - np->nic_tx < TX_LIMIT_START) |
@@ -2456,7 +2492,7 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i | |||
2456 | np->txrxctl_bits |= NVREG_TXRXCTL_RXCHECK; | 2492 | np->txrxctl_bits |= NVREG_TXRXCTL_RXCHECK; |
2457 | dev->features |= NETIF_F_HW_CSUM | NETIF_F_SG; | 2493 | dev->features |= NETIF_F_HW_CSUM | NETIF_F_SG; |
2458 | #ifdef NETIF_F_TSO | 2494 | #ifdef NETIF_F_TSO |
2459 | /* disabled dev->features |= NETIF_F_TSO; */ | 2495 | dev->features |= NETIF_F_TSO; |
2460 | #endif | 2496 | #endif |
2461 | } | 2497 | } |
2462 | 2498 | ||
diff --git a/drivers/net/gianfar.h b/drivers/net/gianfar.h index 94a91da84fbb..cb9d66ac3ab9 100644 --- a/drivers/net/gianfar.h +++ b/drivers/net/gianfar.h | |||
@@ -718,14 +718,14 @@ struct gfar_private { | |||
718 | uint32_t msg_enable; | 718 | uint32_t msg_enable; |
719 | }; | 719 | }; |
720 | 720 | ||
721 | extern inline u32 gfar_read(volatile unsigned *addr) | 721 | static inline u32 gfar_read(volatile unsigned *addr) |
722 | { | 722 | { |
723 | u32 val; | 723 | u32 val; |
724 | val = in_be32(addr); | 724 | val = in_be32(addr); |
725 | return val; | 725 | return val; |
726 | } | 726 | } |
727 | 727 | ||
728 | extern inline void gfar_write(volatile unsigned *addr, u32 val) | 728 | static inline void gfar_write(volatile unsigned *addr, u32 val) |
729 | { | 729 | { |
730 | out_be32(addr, val); | 730 | out_be32(addr, val); |
731 | } | 731 | } |
diff --git a/drivers/net/hp-plus.c b/drivers/net/hp-plus.c index 0abf5dd08b4c..74e167e7dea7 100644 --- a/drivers/net/hp-plus.c +++ b/drivers/net/hp-plus.c | |||
@@ -138,12 +138,6 @@ static int __init do_hpp_probe(struct net_device *dev) | |||
138 | return -ENODEV; | 138 | return -ENODEV; |
139 | } | 139 | } |
140 | 140 | ||
141 | static void cleanup_card(struct net_device *dev) | ||
142 | { | ||
143 | /* NB: hpp_close() handles free_irq */ | ||
144 | release_region(dev->base_addr - NIC_OFFSET, HP_IO_EXTENT); | ||
145 | } | ||
146 | |||
147 | #ifndef MODULE | 141 | #ifndef MODULE |
148 | struct net_device * __init hp_plus_probe(int unit) | 142 | struct net_device * __init hp_plus_probe(int unit) |
149 | { | 143 | { |
@@ -473,6 +467,12 @@ init_module(void) | |||
473 | return -ENXIO; | 467 | return -ENXIO; |
474 | } | 468 | } |
475 | 469 | ||
470 | static void cleanup_card(struct net_device *dev) | ||
471 | { | ||
472 | /* NB: hpp_close() handles free_irq */ | ||
473 | release_region(dev->base_addr - NIC_OFFSET, HP_IO_EXTENT); | ||
474 | } | ||
475 | |||
476 | void | 476 | void |
477 | cleanup_module(void) | 477 | cleanup_module(void) |
478 | { | 478 | { |
diff --git a/drivers/net/hp.c b/drivers/net/hp.c index 59cf841b14ab..cf9fb3698a6b 100644 --- a/drivers/net/hp.c +++ b/drivers/net/hp.c | |||
@@ -102,12 +102,6 @@ static int __init do_hp_probe(struct net_device *dev) | |||
102 | return -ENODEV; | 102 | return -ENODEV; |
103 | } | 103 | } |
104 | 104 | ||
105 | static void cleanup_card(struct net_device *dev) | ||
106 | { | ||
107 | free_irq(dev->irq, dev); | ||
108 | release_region(dev->base_addr - NIC_OFFSET, HP_IO_EXTENT); | ||
109 | } | ||
110 | |||
111 | #ifndef MODULE | 105 | #ifndef MODULE |
112 | struct net_device * __init hp_probe(int unit) | 106 | struct net_device * __init hp_probe(int unit) |
113 | { | 107 | { |
@@ -444,6 +438,12 @@ init_module(void) | |||
444 | return -ENXIO; | 438 | return -ENXIO; |
445 | } | 439 | } |
446 | 440 | ||
441 | static void cleanup_card(struct net_device *dev) | ||
442 | { | ||
443 | free_irq(dev->irq, dev); | ||
444 | release_region(dev->base_addr - NIC_OFFSET, HP_IO_EXTENT); | ||
445 | } | ||
446 | |||
447 | void | 447 | void |
448 | cleanup_module(void) | 448 | cleanup_module(void) |
449 | { | 449 | { |
diff --git a/drivers/net/ibm_emac/ibm_emac.h b/drivers/net/ibm_emac/ibm_emac.h index 644edbff4f94..c2dae6092c4c 100644 --- a/drivers/net/ibm_emac/ibm_emac.h +++ b/drivers/net/ibm_emac/ibm_emac.h | |||
@@ -110,6 +110,7 @@ struct emac_regs { | |||
110 | #define EMAC_MR1_TFS_2K 0x00080000 | 110 | #define EMAC_MR1_TFS_2K 0x00080000 |
111 | #define EMAC_MR1_TR0_MULT 0x00008000 | 111 | #define EMAC_MR1_TR0_MULT 0x00008000 |
112 | #define EMAC_MR1_JPSM 0x00000000 | 112 | #define EMAC_MR1_JPSM 0x00000000 |
113 | #define EMAC_MR1_MWSW_001 0x00000000 | ||
113 | #define EMAC_MR1_BASE(opb) (EMAC_MR1_TFS_2K | EMAC_MR1_TR0_MULT) | 114 | #define EMAC_MR1_BASE(opb) (EMAC_MR1_TFS_2K | EMAC_MR1_TR0_MULT) |
114 | #else | 115 | #else |
115 | #define EMAC_MR1_RFS_4K 0x00180000 | 116 | #define EMAC_MR1_RFS_4K 0x00180000 |
@@ -130,7 +131,7 @@ struct emac_regs { | |||
130 | (freq) <= 83 ? EMAC_MR1_OBCI_83 : \ | 131 | (freq) <= 83 ? EMAC_MR1_OBCI_83 : \ |
131 | (freq) <= 100 ? EMAC_MR1_OBCI_100 : EMAC_MR1_OBCI_100P) | 132 | (freq) <= 100 ? EMAC_MR1_OBCI_100 : EMAC_MR1_OBCI_100P) |
132 | #define EMAC_MR1_BASE(opb) (EMAC_MR1_TFS_2K | EMAC_MR1_TR | \ | 133 | #define EMAC_MR1_BASE(opb) (EMAC_MR1_TFS_2K | EMAC_MR1_TR | \ |
133 | EMAC_MR1_MWSW_001 | EMAC_MR1_OBCI(opb)) | 134 | EMAC_MR1_OBCI(opb)) |
134 | #endif | 135 | #endif |
135 | 136 | ||
136 | /* EMACx_TMR0 */ | 137 | /* EMACx_TMR0 */ |
diff --git a/drivers/net/ibm_emac/ibm_emac_core.c b/drivers/net/ibm_emac/ibm_emac_core.c index 1da8a66f91e1..591c5864ffb1 100644 --- a/drivers/net/ibm_emac/ibm_emac_core.c +++ b/drivers/net/ibm_emac/ibm_emac_core.c | |||
@@ -408,7 +408,7 @@ static int emac_configure(struct ocp_enet_private *dev) | |||
408 | /* Mode register */ | 408 | /* Mode register */ |
409 | r = EMAC_MR1_BASE(emac_opb_mhz()) | EMAC_MR1_VLE | EMAC_MR1_IST; | 409 | r = EMAC_MR1_BASE(emac_opb_mhz()) | EMAC_MR1_VLE | EMAC_MR1_IST; |
410 | if (dev->phy.duplex == DUPLEX_FULL) | 410 | if (dev->phy.duplex == DUPLEX_FULL) |
411 | r |= EMAC_MR1_FDE; | 411 | r |= EMAC_MR1_FDE | EMAC_MR1_MWSW_001; |
412 | dev->stop_timeout = STOP_TIMEOUT_10; | 412 | dev->stop_timeout = STOP_TIMEOUT_10; |
413 | switch (dev->phy.speed) { | 413 | switch (dev->phy.speed) { |
414 | case SPEED_1000: | 414 | case SPEED_1000: |
diff --git a/drivers/net/lance.c b/drivers/net/lance.c index 1d75ca0bb939..d1d714faa6ce 100644 --- a/drivers/net/lance.c +++ b/drivers/net/lance.c | |||
@@ -309,17 +309,6 @@ static void lance_tx_timeout (struct net_device *dev); | |||
309 | 309 | ||
310 | 310 | ||
311 | 311 | ||
312 | static void cleanup_card(struct net_device *dev) | ||
313 | { | ||
314 | struct lance_private *lp = dev->priv; | ||
315 | if (dev->dma != 4) | ||
316 | free_dma(dev->dma); | ||
317 | release_region(dev->base_addr, LANCE_TOTAL_SIZE); | ||
318 | kfree(lp->tx_bounce_buffs); | ||
319 | kfree((void*)lp->rx_buffs); | ||
320 | kfree(lp); | ||
321 | } | ||
322 | |||
323 | #ifdef MODULE | 312 | #ifdef MODULE |
324 | #define MAX_CARDS 8 /* Max number of interfaces (cards) per module */ | 313 | #define MAX_CARDS 8 /* Max number of interfaces (cards) per module */ |
325 | 314 | ||
@@ -367,6 +356,17 @@ int init_module(void) | |||
367 | return -ENXIO; | 356 | return -ENXIO; |
368 | } | 357 | } |
369 | 358 | ||
359 | static void cleanup_card(struct net_device *dev) | ||
360 | { | ||
361 | struct lance_private *lp = dev->priv; | ||
362 | if (dev->dma != 4) | ||
363 | free_dma(dev->dma); | ||
364 | release_region(dev->base_addr, LANCE_TOTAL_SIZE); | ||
365 | kfree(lp->tx_bounce_buffs); | ||
366 | kfree((void*)lp->rx_buffs); | ||
367 | kfree(lp); | ||
368 | } | ||
369 | |||
370 | void cleanup_module(void) | 370 | void cleanup_module(void) |
371 | { | 371 | { |
372 | int this_dev; | 372 | int this_dev; |
diff --git a/drivers/net/lne390.c b/drivers/net/lne390.c index 309d254842cf..646e89fc3562 100644 --- a/drivers/net/lne390.c +++ b/drivers/net/lne390.c | |||
@@ -145,13 +145,6 @@ static int __init do_lne390_probe(struct net_device *dev) | |||
145 | return -ENODEV; | 145 | return -ENODEV; |
146 | } | 146 | } |
147 | 147 | ||
148 | static void cleanup_card(struct net_device *dev) | ||
149 | { | ||
150 | free_irq(dev->irq, dev); | ||
151 | release_region(dev->base_addr, LNE390_IO_EXTENT); | ||
152 | iounmap(ei_status.mem); | ||
153 | } | ||
154 | |||
155 | #ifndef MODULE | 148 | #ifndef MODULE |
156 | struct net_device * __init lne390_probe(int unit) | 149 | struct net_device * __init lne390_probe(int unit) |
157 | { | 150 | { |
@@ -440,6 +433,13 @@ int init_module(void) | |||
440 | return -ENXIO; | 433 | return -ENXIO; |
441 | } | 434 | } |
442 | 435 | ||
436 | static void cleanup_card(struct net_device *dev) | ||
437 | { | ||
438 | free_irq(dev->irq, dev); | ||
439 | release_region(dev->base_addr, LNE390_IO_EXTENT); | ||
440 | iounmap(ei_status.mem); | ||
441 | } | ||
442 | |||
443 | void cleanup_module(void) | 443 | void cleanup_module(void) |
444 | { | 444 | { |
445 | int this_dev; | 445 | int this_dev; |
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c index 3cb9b3fe0cf1..22c3a37bba5a 100644 --- a/drivers/net/mv643xx_eth.c +++ b/drivers/net/mv643xx_eth.c | |||
@@ -6,7 +6,7 @@ | |||
6 | * Copyright (C) 2002 rabeeh@galileo.co.il | 6 | * Copyright (C) 2002 rabeeh@galileo.co.il |
7 | * | 7 | * |
8 | * Copyright (C) 2003 PMC-Sierra, Inc., | 8 | * Copyright (C) 2003 PMC-Sierra, Inc., |
9 | * written by Manish Lachwani (lachwani@pmc-sierra.com) | 9 | * written by Manish Lachwani |
10 | * | 10 | * |
11 | * Copyright (C) 2003 Ralf Baechle <ralf@linux-mips.org> | 11 | * Copyright (C) 2003 Ralf Baechle <ralf@linux-mips.org> |
12 | * | 12 | * |
diff --git a/drivers/net/ne.c b/drivers/net/ne.c index 0de8fdd2aa86..94f782d51f0f 100644 --- a/drivers/net/ne.c +++ b/drivers/net/ne.c | |||
@@ -212,15 +212,6 @@ static int __init do_ne_probe(struct net_device *dev) | |||
212 | return -ENODEV; | 212 | return -ENODEV; |
213 | } | 213 | } |
214 | 214 | ||
215 | static void cleanup_card(struct net_device *dev) | ||
216 | { | ||
217 | struct pnp_dev *idev = (struct pnp_dev *)ei_status.priv; | ||
218 | if (idev) | ||
219 | pnp_device_detach(idev); | ||
220 | free_irq(dev->irq, dev); | ||
221 | release_region(dev->base_addr, NE_IO_EXTENT); | ||
222 | } | ||
223 | |||
224 | #ifndef MODULE | 215 | #ifndef MODULE |
225 | struct net_device * __init ne_probe(int unit) | 216 | struct net_device * __init ne_probe(int unit) |
226 | { | 217 | { |
@@ -859,6 +850,15 @@ int init_module(void) | |||
859 | return -ENODEV; | 850 | return -ENODEV; |
860 | } | 851 | } |
861 | 852 | ||
853 | static void cleanup_card(struct net_device *dev) | ||
854 | { | ||
855 | struct pnp_dev *idev = (struct pnp_dev *)ei_status.priv; | ||
856 | if (idev) | ||
857 | pnp_device_detach(idev); | ||
858 | free_irq(dev->irq, dev); | ||
859 | release_region(dev->base_addr, NE_IO_EXTENT); | ||
860 | } | ||
861 | |||
862 | void cleanup_module(void) | 862 | void cleanup_module(void) |
863 | { | 863 | { |
864 | int this_dev; | 864 | int this_dev; |
diff --git a/drivers/net/ne2.c b/drivers/net/ne2.c index 6d62ada85de6..e6df375a1d4b 100644 --- a/drivers/net/ne2.c +++ b/drivers/net/ne2.c | |||
@@ -278,14 +278,6 @@ static int __init do_ne2_probe(struct net_device *dev) | |||
278 | return -ENODEV; | 278 | return -ENODEV; |
279 | } | 279 | } |
280 | 280 | ||
281 | static void cleanup_card(struct net_device *dev) | ||
282 | { | ||
283 | mca_mark_as_unused(ei_status.priv); | ||
284 | mca_set_adapter_procfn( ei_status.priv, NULL, NULL); | ||
285 | free_irq(dev->irq, dev); | ||
286 | release_region(dev->base_addr, NE_IO_EXTENT); | ||
287 | } | ||
288 | |||
289 | #ifndef MODULE | 281 | #ifndef MODULE |
290 | struct net_device * __init ne2_probe(int unit) | 282 | struct net_device * __init ne2_probe(int unit) |
291 | { | 283 | { |
@@ -812,6 +804,14 @@ int init_module(void) | |||
812 | return -ENXIO; | 804 | return -ENXIO; |
813 | } | 805 | } |
814 | 806 | ||
807 | static void cleanup_card(struct net_device *dev) | ||
808 | { | ||
809 | mca_mark_as_unused(ei_status.priv); | ||
810 | mca_set_adapter_procfn( ei_status.priv, NULL, NULL); | ||
811 | free_irq(dev->irq, dev); | ||
812 | release_region(dev->base_addr, NE_IO_EXTENT); | ||
813 | } | ||
814 | |||
815 | void cleanup_module(void) | 815 | void cleanup_module(void) |
816 | { | 816 | { |
817 | int this_dev; | 817 | int this_dev; |
diff --git a/drivers/net/sk98lin/skge.c b/drivers/net/sk98lin/skge.c index 9a76ac180b11..197edd74fbb5 100644 --- a/drivers/net/sk98lin/skge.c +++ b/drivers/net/sk98lin/skge.c | |||
@@ -282,26 +282,22 @@ SK_U32 Val) /* pointer to store the read value */ | |||
282 | * Description: | 282 | * Description: |
283 | * This function initialize the PCI resources and IO | 283 | * This function initialize the PCI resources and IO |
284 | * | 284 | * |
285 | * Returns: N/A | 285 | * Returns: |
286 | * | 286 | * 0 - indicate everything worked ok. |
287 | * != 0 - error indication | ||
287 | */ | 288 | */ |
288 | int SkGeInitPCI(SK_AC *pAC) | 289 | static __devinit int SkGeInitPCI(SK_AC *pAC) |
289 | { | 290 | { |
290 | struct SK_NET_DEVICE *dev = pAC->dev[0]; | 291 | struct SK_NET_DEVICE *dev = pAC->dev[0]; |
291 | struct pci_dev *pdev = pAC->PciDev; | 292 | struct pci_dev *pdev = pAC->PciDev; |
292 | int retval; | 293 | int retval; |
293 | 294 | ||
294 | if (pci_enable_device(pdev) != 0) { | ||
295 | return 1; | ||
296 | } | ||
297 | |||
298 | dev->mem_start = pci_resource_start (pdev, 0); | 295 | dev->mem_start = pci_resource_start (pdev, 0); |
299 | pci_set_master(pdev); | 296 | pci_set_master(pdev); |
300 | 297 | ||
301 | if (pci_request_regions(pdev, "sk98lin") != 0) { | 298 | retval = pci_request_regions(pdev, "sk98lin"); |
302 | retval = 2; | 299 | if (retval) |
303 | goto out_disable; | 300 | goto out; |
304 | } | ||
305 | 301 | ||
306 | #ifdef SK_BIG_ENDIAN | 302 | #ifdef SK_BIG_ENDIAN |
307 | /* | 303 | /* |
@@ -320,9 +316,8 @@ int SkGeInitPCI(SK_AC *pAC) | |||
320 | * Remap the regs into kernel space. | 316 | * Remap the regs into kernel space. |
321 | */ | 317 | */ |
322 | pAC->IoBase = ioremap_nocache(dev->mem_start, 0x4000); | 318 | pAC->IoBase = ioremap_nocache(dev->mem_start, 0x4000); |
323 | 319 | if (!pAC->IoBase) { | |
324 | if (!pAC->IoBase){ | 320 | retval = -EIO; |
325 | retval = 3; | ||
326 | goto out_release; | 321 | goto out_release; |
327 | } | 322 | } |
328 | 323 | ||
@@ -330,8 +325,7 @@ int SkGeInitPCI(SK_AC *pAC) | |||
330 | 325 | ||
331 | out_release: | 326 | out_release: |
332 | pci_release_regions(pdev); | 327 | pci_release_regions(pdev); |
333 | out_disable: | 328 | out: |
334 | pci_disable_device(pdev); | ||
335 | return retval; | 329 | return retval; |
336 | } | 330 | } |
337 | 331 | ||
@@ -492,7 +486,7 @@ module_param_array(AutoSizing, charp, NULL, 0); | |||
492 | * 0, if everything is ok | 486 | * 0, if everything is ok |
493 | * !=0, on error | 487 | * !=0, on error |
494 | */ | 488 | */ |
495 | static int __init SkGeBoardInit(struct SK_NET_DEVICE *dev, SK_AC *pAC) | 489 | static int __devinit SkGeBoardInit(struct SK_NET_DEVICE *dev, SK_AC *pAC) |
496 | { | 490 | { |
497 | short i; | 491 | short i; |
498 | unsigned long Flags; | 492 | unsigned long Flags; |
@@ -529,7 +523,7 @@ SK_BOOL DualNet; | |||
529 | if (SkGeInit(pAC, pAC->IoBase, SK_INIT_DATA) != 0) { | 523 | if (SkGeInit(pAC, pAC->IoBase, SK_INIT_DATA) != 0) { |
530 | printk("HWInit (0) failed.\n"); | 524 | printk("HWInit (0) failed.\n"); |
531 | spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); | 525 | spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); |
532 | return(-EAGAIN); | 526 | return -EIO; |
533 | } | 527 | } |
534 | SkI2cInit( pAC, pAC->IoBase, SK_INIT_DATA); | 528 | SkI2cInit( pAC, pAC->IoBase, SK_INIT_DATA); |
535 | SkEventInit(pAC, pAC->IoBase, SK_INIT_DATA); | 529 | SkEventInit(pAC, pAC->IoBase, SK_INIT_DATA); |
@@ -551,7 +545,7 @@ SK_BOOL DualNet; | |||
551 | if (SkGeInit(pAC, pAC->IoBase, SK_INIT_IO) != 0) { | 545 | if (SkGeInit(pAC, pAC->IoBase, SK_INIT_IO) != 0) { |
552 | printk("sk98lin: HWInit (1) failed.\n"); | 546 | printk("sk98lin: HWInit (1) failed.\n"); |
553 | spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); | 547 | spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); |
554 | return(-EAGAIN); | 548 | return -EIO; |
555 | } | 549 | } |
556 | SkI2cInit( pAC, pAC->IoBase, SK_INIT_IO); | 550 | SkI2cInit( pAC, pAC->IoBase, SK_INIT_IO); |
557 | SkEventInit(pAC, pAC->IoBase, SK_INIT_IO); | 551 | SkEventInit(pAC, pAC->IoBase, SK_INIT_IO); |
@@ -583,20 +577,20 @@ SK_BOOL DualNet; | |||
583 | } else { | 577 | } else { |
584 | printk(KERN_WARNING "sk98lin: Illegal number of ports: %d\n", | 578 | printk(KERN_WARNING "sk98lin: Illegal number of ports: %d\n", |
585 | pAC->GIni.GIMacsFound); | 579 | pAC->GIni.GIMacsFound); |
586 | return -EAGAIN; | 580 | return -EIO; |
587 | } | 581 | } |
588 | 582 | ||
589 | if (Ret) { | 583 | if (Ret) { |
590 | printk(KERN_WARNING "sk98lin: Requested IRQ %d is busy.\n", | 584 | printk(KERN_WARNING "sk98lin: Requested IRQ %d is busy.\n", |
591 | dev->irq); | 585 | dev->irq); |
592 | return -EAGAIN; | 586 | return Ret; |
593 | } | 587 | } |
594 | pAC->AllocFlag |= SK_ALLOC_IRQ; | 588 | pAC->AllocFlag |= SK_ALLOC_IRQ; |
595 | 589 | ||
596 | /* Alloc memory for this board (Mem for RxD/TxD) : */ | 590 | /* Alloc memory for this board (Mem for RxD/TxD) : */ |
597 | if(!BoardAllocMem(pAC)) { | 591 | if(!BoardAllocMem(pAC)) { |
598 | printk("No memory for descriptor rings.\n"); | 592 | printk("No memory for descriptor rings.\n"); |
599 | return(-EAGAIN); | 593 | return -ENOMEM; |
600 | } | 594 | } |
601 | 595 | ||
602 | BoardInitMem(pAC); | 596 | BoardInitMem(pAC); |
@@ -612,7 +606,7 @@ SK_BOOL DualNet; | |||
612 | DualNet)) { | 606 | DualNet)) { |
613 | BoardFreeMem(pAC); | 607 | BoardFreeMem(pAC); |
614 | printk("sk98lin: SkGeInitAssignRamToQueues failed.\n"); | 608 | printk("sk98lin: SkGeInitAssignRamToQueues failed.\n"); |
615 | return(-EAGAIN); | 609 | return -EIO; |
616 | } | 610 | } |
617 | 611 | ||
618 | return (0); | 612 | return (0); |
@@ -633,8 +627,7 @@ SK_BOOL DualNet; | |||
633 | * SK_TRUE, if all memory could be allocated | 627 | * SK_TRUE, if all memory could be allocated |
634 | * SK_FALSE, if not | 628 | * SK_FALSE, if not |
635 | */ | 629 | */ |
636 | static SK_BOOL BoardAllocMem( | 630 | static __devinit SK_BOOL BoardAllocMem(SK_AC *pAC) |
637 | SK_AC *pAC) | ||
638 | { | 631 | { |
639 | caddr_t pDescrMem; /* pointer to descriptor memory area */ | 632 | caddr_t pDescrMem; /* pointer to descriptor memory area */ |
640 | size_t AllocLength; /* length of complete descriptor area */ | 633 | size_t AllocLength; /* length of complete descriptor area */ |
@@ -727,8 +720,7 @@ size_t AllocLength; /* length of complete descriptor area */ | |||
727 | * | 720 | * |
728 | * Returns: N/A | 721 | * Returns: N/A |
729 | */ | 722 | */ |
730 | static void BoardInitMem( | 723 | static __devinit void BoardInitMem(SK_AC *pAC) |
731 | SK_AC *pAC) /* pointer to adapter context */ | ||
732 | { | 724 | { |
733 | int i; /* loop counter */ | 725 | int i; /* loop counter */ |
734 | int RxDescrSize; /* the size of a rx descriptor rounded up to alignment*/ | 726 | int RxDescrSize; /* the size of a rx descriptor rounded up to alignment*/ |
@@ -4776,32 +4768,47 @@ static int __devinit skge_probe_one(struct pci_dev *pdev, | |||
4776 | struct net_device *dev = NULL; | 4768 | struct net_device *dev = NULL; |
4777 | static int boards_found = 0; | 4769 | static int boards_found = 0; |
4778 | int error = -ENODEV; | 4770 | int error = -ENODEV; |
4771 | int using_dac = 0; | ||
4779 | char DeviceStr[80]; | 4772 | char DeviceStr[80]; |
4780 | 4773 | ||
4781 | if (pci_enable_device(pdev)) | 4774 | if (pci_enable_device(pdev)) |
4782 | goto out; | 4775 | goto out; |
4783 | 4776 | ||
4784 | /* Configure DMA attributes. */ | 4777 | /* Configure DMA attributes. */ |
4785 | if (pci_set_dma_mask(pdev, DMA_64BIT_MASK) && | 4778 | if (sizeof(dma_addr_t) > sizeof(u32) && |
4786 | pci_set_dma_mask(pdev, DMA_32BIT_MASK)) | 4779 | !(error = pci_set_dma_mask(pdev, DMA_64BIT_MASK))) { |
4787 | goto out_disable_device; | 4780 | using_dac = 1; |
4788 | 4781 | error = pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK); | |
4782 | if (error < 0) { | ||
4783 | printk(KERN_ERR "sk98lin %s unable to obtain 64 bit DMA " | ||
4784 | "for consistent allocations\n", pci_name(pdev)); | ||
4785 | goto out_disable_device; | ||
4786 | } | ||
4787 | } else { | ||
4788 | error = pci_set_dma_mask(pdev, DMA_32BIT_MASK); | ||
4789 | if (error) { | ||
4790 | printk(KERN_ERR "sk98lin %s no usable DMA configuration\n", | ||
4791 | pci_name(pdev)); | ||
4792 | goto out_disable_device; | ||
4793 | } | ||
4794 | } | ||
4789 | 4795 | ||
4790 | if ((dev = alloc_etherdev(sizeof(DEV_NET))) == NULL) { | 4796 | error = -ENOMEM; |
4791 | printk(KERN_ERR "Unable to allocate etherdev " | 4797 | dev = alloc_etherdev(sizeof(DEV_NET)); |
4798 | if (!dev) { | ||
4799 | printk(KERN_ERR "sk98lin: unable to allocate etherdev " | ||
4792 | "structure!\n"); | 4800 | "structure!\n"); |
4793 | goto out_disable_device; | 4801 | goto out_disable_device; |
4794 | } | 4802 | } |
4795 | 4803 | ||
4796 | pNet = netdev_priv(dev); | 4804 | pNet = netdev_priv(dev); |
4797 | pNet->pAC = kmalloc(sizeof(SK_AC), GFP_KERNEL); | 4805 | pNet->pAC = kzalloc(sizeof(SK_AC), GFP_KERNEL); |
4798 | if (!pNet->pAC) { | 4806 | if (!pNet->pAC) { |
4799 | printk(KERN_ERR "Unable to allocate adapter " | 4807 | printk(KERN_ERR "sk98lin: unable to allocate adapter " |
4800 | "structure!\n"); | 4808 | "structure!\n"); |
4801 | goto out_free_netdev; | 4809 | goto out_free_netdev; |
4802 | } | 4810 | } |
4803 | 4811 | ||
4804 | memset(pNet->pAC, 0, sizeof(SK_AC)); | ||
4805 | pAC = pNet->pAC; | 4812 | pAC = pNet->pAC; |
4806 | pAC->PciDev = pdev; | 4813 | pAC->PciDev = pdev; |
4807 | 4814 | ||
@@ -4810,6 +4817,7 @@ static int __devinit skge_probe_one(struct pci_dev *pdev, | |||
4810 | pAC->CheckQueue = SK_FALSE; | 4817 | pAC->CheckQueue = SK_FALSE; |
4811 | 4818 | ||
4812 | dev->irq = pdev->irq; | 4819 | dev->irq = pdev->irq; |
4820 | |||
4813 | error = SkGeInitPCI(pAC); | 4821 | error = SkGeInitPCI(pAC); |
4814 | if (error) { | 4822 | if (error) { |
4815 | printk(KERN_ERR "sk98lin: PCI setup failed: %i\n", error); | 4823 | printk(KERN_ERR "sk98lin: PCI setup failed: %i\n", error); |
@@ -4844,19 +4852,25 @@ static int __devinit skge_probe_one(struct pci_dev *pdev, | |||
4844 | #endif | 4852 | #endif |
4845 | } | 4853 | } |
4846 | 4854 | ||
4855 | if (using_dac) | ||
4856 | dev->features |= NETIF_F_HIGHDMA; | ||
4857 | |||
4847 | pAC->Index = boards_found++; | 4858 | pAC->Index = boards_found++; |
4848 | 4859 | ||
4849 | if (SkGeBoardInit(dev, pAC)) | 4860 | error = SkGeBoardInit(dev, pAC); |
4861 | if (error) | ||
4850 | goto out_free_netdev; | 4862 | goto out_free_netdev; |
4851 | 4863 | ||
4852 | /* Read Adapter name from VPD */ | 4864 | /* Read Adapter name from VPD */ |
4853 | if (ProductStr(pAC, DeviceStr, sizeof(DeviceStr)) != 0) { | 4865 | if (ProductStr(pAC, DeviceStr, sizeof(DeviceStr)) != 0) { |
4866 | error = -EIO; | ||
4854 | printk(KERN_ERR "sk98lin: Could not read VPD data.\n"); | 4867 | printk(KERN_ERR "sk98lin: Could not read VPD data.\n"); |
4855 | goto out_free_resources; | 4868 | goto out_free_resources; |
4856 | } | 4869 | } |
4857 | 4870 | ||
4858 | /* Register net device */ | 4871 | /* Register net device */ |
4859 | if (register_netdev(dev)) { | 4872 | error = register_netdev(dev); |
4873 | if (error) { | ||
4860 | printk(KERN_ERR "sk98lin: Could not register device.\n"); | 4874 | printk(KERN_ERR "sk98lin: Could not register device.\n"); |
4861 | goto out_free_resources; | 4875 | goto out_free_resources; |
4862 | } | 4876 | } |
@@ -4883,15 +4897,17 @@ static int __devinit skge_probe_one(struct pci_dev *pdev, | |||
4883 | 4897 | ||
4884 | boards_found++; | 4898 | boards_found++; |
4885 | 4899 | ||
4900 | pci_set_drvdata(pdev, dev); | ||
4901 | |||
4886 | /* More then one port found */ | 4902 | /* More then one port found */ |
4887 | if ((pAC->GIni.GIMacsFound == 2 ) && (pAC->RlmtNets == 2)) { | 4903 | if ((pAC->GIni.GIMacsFound == 2 ) && (pAC->RlmtNets == 2)) { |
4888 | if ((dev = alloc_etherdev(sizeof(DEV_NET))) == 0) { | 4904 | dev = alloc_etherdev(sizeof(DEV_NET)); |
4889 | printk(KERN_ERR "Unable to allocate etherdev " | 4905 | if (!dev) { |
4906 | printk(KERN_ERR "sk98lin: unable to allocate etherdev " | ||
4890 | "structure!\n"); | 4907 | "structure!\n"); |
4891 | goto out; | 4908 | goto single_port; |
4892 | } | 4909 | } |
4893 | 4910 | ||
4894 | pAC->dev[1] = dev; | ||
4895 | pNet = netdev_priv(dev); | 4911 | pNet = netdev_priv(dev); |
4896 | pNet->PortNr = 1; | 4912 | pNet->PortNr = 1; |
4897 | pNet->NetNr = 1; | 4913 | pNet->NetNr = 1; |
@@ -4920,20 +4936,28 @@ static int __devinit skge_probe_one(struct pci_dev *pdev, | |||
4920 | #endif | 4936 | #endif |
4921 | } | 4937 | } |
4922 | 4938 | ||
4923 | if (register_netdev(dev)) { | 4939 | if (using_dac) |
4924 | printk(KERN_ERR "sk98lin: Could not register device for seconf port.\n"); | 4940 | dev->features |= NETIF_F_HIGHDMA; |
4941 | |||
4942 | error = register_netdev(dev); | ||
4943 | if (error) { | ||
4944 | printk(KERN_ERR "sk98lin: Could not register device" | ||
4945 | " for second port. (%d)\n", error); | ||
4925 | free_netdev(dev); | 4946 | free_netdev(dev); |
4926 | pAC->dev[1] = pAC->dev[0]; | 4947 | goto single_port; |
4927 | } else { | ||
4928 | memcpy(&dev->dev_addr, | ||
4929 | &pAC->Addr.Net[1].CurrentMacAddress, 6); | ||
4930 | memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); | ||
4931 | |||
4932 | printk("%s: %s\n", dev->name, DeviceStr); | ||
4933 | printk(" PrefPort:B RlmtMode:Dual Check Link State\n"); | ||
4934 | } | 4948 | } |
4949 | |||
4950 | pAC->dev[1] = dev; | ||
4951 | memcpy(&dev->dev_addr, | ||
4952 | &pAC->Addr.Net[1].CurrentMacAddress, 6); | ||
4953 | memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); | ||
4954 | |||
4955 | printk("%s: %s\n", dev->name, DeviceStr); | ||
4956 | printk(" PrefPort:B RlmtMode:Dual Check Link State\n"); | ||
4935 | } | 4957 | } |
4936 | 4958 | ||
4959 | single_port: | ||
4960 | |||
4937 | /* Save the hardware revision */ | 4961 | /* Save the hardware revision */ |
4938 | pAC->HWRevision = (((pAC->GIni.GIPciHwRev >> 4) & 0x0F)*10) + | 4962 | pAC->HWRevision = (((pAC->GIni.GIPciHwRev >> 4) & 0x0F)*10) + |
4939 | (pAC->GIni.GIPciHwRev & 0x0F); | 4963 | (pAC->GIni.GIPciHwRev & 0x0F); |
@@ -4945,7 +4969,6 @@ static int __devinit skge_probe_one(struct pci_dev *pdev, | |||
4945 | memset(&pAC->PnmiBackup, 0, sizeof(SK_PNMI_STRUCT_DATA)); | 4969 | memset(&pAC->PnmiBackup, 0, sizeof(SK_PNMI_STRUCT_DATA)); |
4946 | memcpy(&pAC->PnmiBackup, &pAC->PnmiStruct, sizeof(SK_PNMI_STRUCT_DATA)); | 4970 | memcpy(&pAC->PnmiBackup, &pAC->PnmiStruct, sizeof(SK_PNMI_STRUCT_DATA)); |
4947 | 4971 | ||
4948 | pci_set_drvdata(pdev, dev); | ||
4949 | return 0; | 4972 | return 0; |
4950 | 4973 | ||
4951 | out_free_resources: | 4974 | out_free_resources: |
diff --git a/drivers/net/smc-ultra.c b/drivers/net/smc-ultra.c index ba8593ac3f8a..3db30cd0625e 100644 --- a/drivers/net/smc-ultra.c +++ b/drivers/net/smc-ultra.c | |||
@@ -168,18 +168,6 @@ static int __init do_ultra_probe(struct net_device *dev) | |||
168 | return -ENODEV; | 168 | return -ENODEV; |
169 | } | 169 | } |
170 | 170 | ||
171 | static void cleanup_card(struct net_device *dev) | ||
172 | { | ||
173 | /* NB: ultra_close_card() does free_irq */ | ||
174 | #ifdef __ISAPNP__ | ||
175 | struct pnp_dev *idev = (struct pnp_dev *)ei_status.priv; | ||
176 | if (idev) | ||
177 | pnp_device_detach(idev); | ||
178 | #endif | ||
179 | release_region(dev->base_addr - ULTRA_NIC_OFFSET, ULTRA_IO_EXTENT); | ||
180 | iounmap(ei_status.mem); | ||
181 | } | ||
182 | |||
183 | #ifndef MODULE | 171 | #ifndef MODULE |
184 | struct net_device * __init ultra_probe(int unit) | 172 | struct net_device * __init ultra_probe(int unit) |
185 | { | 173 | { |
@@ -594,6 +582,18 @@ init_module(void) | |||
594 | return -ENXIO; | 582 | return -ENXIO; |
595 | } | 583 | } |
596 | 584 | ||
585 | static void cleanup_card(struct net_device *dev) | ||
586 | { | ||
587 | /* NB: ultra_close_card() does free_irq */ | ||
588 | #ifdef __ISAPNP__ | ||
589 | struct pnp_dev *idev = (struct pnp_dev *)ei_status.priv; | ||
590 | if (idev) | ||
591 | pnp_device_detach(idev); | ||
592 | #endif | ||
593 | release_region(dev->base_addr - ULTRA_NIC_OFFSET, ULTRA_IO_EXTENT); | ||
594 | iounmap(ei_status.mem); | ||
595 | } | ||
596 | |||
597 | void | 597 | void |
598 | cleanup_module(void) | 598 | cleanup_module(void) |
599 | { | 599 | { |
diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c index 125ed00e95a5..c67c91251d04 100644 --- a/drivers/net/tulip/tulip_core.c +++ b/drivers/net/tulip/tulip_core.c | |||
@@ -1564,7 +1564,7 @@ static int __devinit tulip_init_one (struct pci_dev *pdev, | |||
1564 | dev->dev_addr, 6); | 1564 | dev->dev_addr, 6); |
1565 | } | 1565 | } |
1566 | #endif | 1566 | #endif |
1567 | #if defined(__i386__) /* Patch up x86 BIOS bug. */ | 1567 | #if defined(__i386__) || defined(__x86_64__) /* Patch up x86 BIOS bug. */ |
1568 | if (last_irq) | 1568 | if (last_irq) |
1569 | irq = last_irq; | 1569 | irq = last_irq; |
1570 | #endif | 1570 | #endif |
diff --git a/drivers/net/wd.c b/drivers/net/wd.c index b03feae459fc..7caa8dc88a58 100644 --- a/drivers/net/wd.c +++ b/drivers/net/wd.c | |||
@@ -127,13 +127,6 @@ static int __init do_wd_probe(struct net_device *dev) | |||
127 | return -ENODEV; | 127 | return -ENODEV; |
128 | } | 128 | } |
129 | 129 | ||
130 | static void cleanup_card(struct net_device *dev) | ||
131 | { | ||
132 | free_irq(dev->irq, dev); | ||
133 | release_region(dev->base_addr - WD_NIC_OFFSET, WD_IO_EXTENT); | ||
134 | iounmap(ei_status.mem); | ||
135 | } | ||
136 | |||
137 | #ifndef MODULE | 130 | #ifndef MODULE |
138 | struct net_device * __init wd_probe(int unit) | 131 | struct net_device * __init wd_probe(int unit) |
139 | { | 132 | { |
@@ -538,6 +531,13 @@ init_module(void) | |||
538 | return -ENXIO; | 531 | return -ENXIO; |
539 | } | 532 | } |
540 | 533 | ||
534 | static void cleanup_card(struct net_device *dev) | ||
535 | { | ||
536 | free_irq(dev->irq, dev); | ||
537 | release_region(dev->base_addr - WD_NIC_OFFSET, WD_IO_EXTENT); | ||
538 | iounmap(ei_status.mem); | ||
539 | } | ||
540 | |||
541 | void | 541 | void |
542 | cleanup_module(void) | 542 | cleanup_module(void) |
543 | { | 543 | { |
diff --git a/drivers/net/wireless/ipw2100.c b/drivers/net/wireless/ipw2100.c index 44cd3fcd1572..cf05661fb1bd 100644 --- a/drivers/net/wireless/ipw2100.c +++ b/drivers/net/wireless/ipw2100.c | |||
@@ -7153,7 +7153,7 @@ static int ipw2100_wx_get_range(struct net_device *dev, | |||
7153 | 7153 | ||
7154 | /* Set the Wireless Extension versions */ | 7154 | /* Set the Wireless Extension versions */ |
7155 | range->we_version_compiled = WIRELESS_EXT; | 7155 | range->we_version_compiled = WIRELESS_EXT; |
7156 | range->we_version_source = 16; | 7156 | range->we_version_source = 18; |
7157 | 7157 | ||
7158 | // range->retry_capa; /* What retry options are supported */ | 7158 | // range->retry_capa; /* What retry options are supported */ |
7159 | // range->retry_flags; /* How to decode max/min retry limit */ | 7159 | // range->retry_flags; /* How to decode max/min retry limit */ |
@@ -7184,6 +7184,9 @@ static int ipw2100_wx_get_range(struct net_device *dev, | |||
7184 | IW_EVENT_CAPA_MASK(SIOCGIWAP)); | 7184 | IW_EVENT_CAPA_MASK(SIOCGIWAP)); |
7185 | range->event_capa[1] = IW_EVENT_CAPA_K_1; | 7185 | range->event_capa[1] = IW_EVENT_CAPA_K_1; |
7186 | 7186 | ||
7187 | range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 | | ||
7188 | IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP; | ||
7189 | |||
7187 | IPW_DEBUG_WX("GET Range\n"); | 7190 | IPW_DEBUG_WX("GET Range\n"); |
7188 | 7191 | ||
7189 | return 0; | 7192 | return 0; |
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index 180676d7115a..ee5f4dfdab14 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c | |||
@@ -69,7 +69,6 @@ | |||
69 | #include "scsi_logging.h" | 69 | #include "scsi_logging.h" |
70 | 70 | ||
71 | static void scsi_done(struct scsi_cmnd *cmd); | 71 | static void scsi_done(struct scsi_cmnd *cmd); |
72 | static int scsi_retry_command(struct scsi_cmnd *cmd); | ||
73 | 72 | ||
74 | /* | 73 | /* |
75 | * Definitions and constants. | 74 | * Definitions and constants. |
@@ -752,7 +751,7 @@ static void scsi_done(struct scsi_cmnd *cmd) | |||
752 | * isn't running --- used by scsi_times_out */ | 751 | * isn't running --- used by scsi_times_out */ |
753 | void __scsi_done(struct scsi_cmnd *cmd) | 752 | void __scsi_done(struct scsi_cmnd *cmd) |
754 | { | 753 | { |
755 | unsigned long flags; | 754 | struct request *rq = cmd->request; |
756 | 755 | ||
757 | /* | 756 | /* |
758 | * Set the serial numbers back to zero | 757 | * Set the serial numbers back to zero |
@@ -763,71 +762,14 @@ void __scsi_done(struct scsi_cmnd *cmd) | |||
763 | if (cmd->result) | 762 | if (cmd->result) |
764 | atomic_inc(&cmd->device->ioerr_cnt); | 763 | atomic_inc(&cmd->device->ioerr_cnt); |
765 | 764 | ||
765 | BUG_ON(!rq); | ||
766 | |||
766 | /* | 767 | /* |
767 | * Next, enqueue the command into the done queue. | 768 | * The uptodate/nbytes values don't matter, as we allow partial |
768 | * It is a per-CPU queue, so we just disable local interrupts | 769 | * completes and thus will check this in the softirq callback |
769 | * and need no spinlock. | ||
770 | */ | 770 | */ |
771 | local_irq_save(flags); | 771 | rq->completion_data = cmd; |
772 | list_add_tail(&cmd->eh_entry, &__get_cpu_var(scsi_done_q)); | 772 | blk_complete_request(rq); |
773 | raise_softirq_irqoff(SCSI_SOFTIRQ); | ||
774 | local_irq_restore(flags); | ||
775 | } | ||
776 | |||
777 | /** | ||
778 | * scsi_softirq - Perform post-interrupt processing of finished SCSI commands. | ||
779 | * | ||
780 | * This is the consumer of the done queue. | ||
781 | * | ||
782 | * This is called with all interrupts enabled. This should reduce | ||
783 | * interrupt latency, stack depth, and reentrancy of the low-level | ||
784 | * drivers. | ||
785 | */ | ||
786 | static void scsi_softirq(struct softirq_action *h) | ||
787 | { | ||
788 | int disposition; | ||
789 | LIST_HEAD(local_q); | ||
790 | |||
791 | local_irq_disable(); | ||
792 | list_splice_init(&__get_cpu_var(scsi_done_q), &local_q); | ||
793 | local_irq_enable(); | ||
794 | |||
795 | while (!list_empty(&local_q)) { | ||
796 | struct scsi_cmnd *cmd = list_entry(local_q.next, | ||
797 | struct scsi_cmnd, eh_entry); | ||
798 | /* The longest time any command should be outstanding is the | ||
799 | * per command timeout multiplied by the number of retries. | ||
800 | * | ||
801 | * For a typical command, this is 2.5 minutes */ | ||
802 | unsigned long wait_for | ||
803 | = cmd->allowed * cmd->timeout_per_command; | ||
804 | list_del_init(&cmd->eh_entry); | ||
805 | |||
806 | disposition = scsi_decide_disposition(cmd); | ||
807 | if (disposition != SUCCESS && | ||
808 | time_before(cmd->jiffies_at_alloc + wait_for, jiffies)) { | ||
809 | sdev_printk(KERN_ERR, cmd->device, | ||
810 | "timing out command, waited %lus\n", | ||
811 | wait_for/HZ); | ||
812 | disposition = SUCCESS; | ||
813 | } | ||
814 | |||
815 | scsi_log_completion(cmd, disposition); | ||
816 | switch (disposition) { | ||
817 | case SUCCESS: | ||
818 | scsi_finish_command(cmd); | ||
819 | break; | ||
820 | case NEEDS_RETRY: | ||
821 | scsi_retry_command(cmd); | ||
822 | break; | ||
823 | case ADD_TO_MLQUEUE: | ||
824 | scsi_queue_insert(cmd, SCSI_MLQUEUE_DEVICE_BUSY); | ||
825 | break; | ||
826 | default: | ||
827 | if (!scsi_eh_scmd_add(cmd, 0)) | ||
828 | scsi_finish_command(cmd); | ||
829 | } | ||
830 | } | ||
831 | } | 773 | } |
832 | 774 | ||
833 | /* | 775 | /* |
@@ -840,7 +782,7 @@ static void scsi_softirq(struct softirq_action *h) | |||
840 | * level drivers should not become re-entrant as a result of | 782 | * level drivers should not become re-entrant as a result of |
841 | * this. | 783 | * this. |
842 | */ | 784 | */ |
843 | static int scsi_retry_command(struct scsi_cmnd *cmd) | 785 | int scsi_retry_command(struct scsi_cmnd *cmd) |
844 | { | 786 | { |
845 | /* | 787 | /* |
846 | * Restore the SCSI command state. | 788 | * Restore the SCSI command state. |
@@ -1273,38 +1215,6 @@ int scsi_device_cancel(struct scsi_device *sdev, int recovery) | |||
1273 | } | 1215 | } |
1274 | EXPORT_SYMBOL(scsi_device_cancel); | 1216 | EXPORT_SYMBOL(scsi_device_cancel); |
1275 | 1217 | ||
1276 | #ifdef CONFIG_HOTPLUG_CPU | ||
1277 | static int scsi_cpu_notify(struct notifier_block *self, | ||
1278 | unsigned long action, void *hcpu) | ||
1279 | { | ||
1280 | int cpu = (unsigned long)hcpu; | ||
1281 | |||
1282 | switch(action) { | ||
1283 | case CPU_DEAD: | ||
1284 | /* Drain scsi_done_q. */ | ||
1285 | local_irq_disable(); | ||
1286 | list_splice_init(&per_cpu(scsi_done_q, cpu), | ||
1287 | &__get_cpu_var(scsi_done_q)); | ||
1288 | raise_softirq_irqoff(SCSI_SOFTIRQ); | ||
1289 | local_irq_enable(); | ||
1290 | break; | ||
1291 | default: | ||
1292 | break; | ||
1293 | } | ||
1294 | return NOTIFY_OK; | ||
1295 | } | ||
1296 | |||
1297 | static struct notifier_block __devinitdata scsi_cpu_nb = { | ||
1298 | .notifier_call = scsi_cpu_notify, | ||
1299 | }; | ||
1300 | |||
1301 | #define register_scsi_cpu() register_cpu_notifier(&scsi_cpu_nb) | ||
1302 | #define unregister_scsi_cpu() unregister_cpu_notifier(&scsi_cpu_nb) | ||
1303 | #else | ||
1304 | #define register_scsi_cpu() | ||
1305 | #define unregister_scsi_cpu() | ||
1306 | #endif /* CONFIG_HOTPLUG_CPU */ | ||
1307 | |||
1308 | MODULE_DESCRIPTION("SCSI core"); | 1218 | MODULE_DESCRIPTION("SCSI core"); |
1309 | MODULE_LICENSE("GPL"); | 1219 | MODULE_LICENSE("GPL"); |
1310 | 1220 | ||
@@ -1338,8 +1248,6 @@ static int __init init_scsi(void) | |||
1338 | INIT_LIST_HEAD(&per_cpu(scsi_done_q, i)); | 1248 | INIT_LIST_HEAD(&per_cpu(scsi_done_q, i)); |
1339 | 1249 | ||
1340 | devfs_mk_dir("scsi"); | 1250 | devfs_mk_dir("scsi"); |
1341 | open_softirq(SCSI_SOFTIRQ, scsi_softirq, NULL); | ||
1342 | register_scsi_cpu(); | ||
1343 | printk(KERN_NOTICE "SCSI subsystem initialized\n"); | 1251 | printk(KERN_NOTICE "SCSI subsystem initialized\n"); |
1344 | return 0; | 1252 | return 0; |
1345 | 1253 | ||
@@ -1367,7 +1275,6 @@ static void __exit exit_scsi(void) | |||
1367 | devfs_remove("scsi"); | 1275 | devfs_remove("scsi"); |
1368 | scsi_exit_procfs(); | 1276 | scsi_exit_procfs(); |
1369 | scsi_exit_queue(); | 1277 | scsi_exit_queue(); |
1370 | unregister_scsi_cpu(); | ||
1371 | } | 1278 | } |
1372 | 1279 | ||
1373 | subsys_initcall(init_scsi); | 1280 | subsys_initcall(init_scsi); |
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index ba93d6e66d48..00c9bf383e23 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -1493,6 +1493,41 @@ static void scsi_kill_request(struct request *req, request_queue_t *q) | |||
1493 | __scsi_done(cmd); | 1493 | __scsi_done(cmd); |
1494 | } | 1494 | } |
1495 | 1495 | ||
1496 | static void scsi_softirq_done(struct request *rq) | ||
1497 | { | ||
1498 | struct scsi_cmnd *cmd = rq->completion_data; | ||
1499 | unsigned long wait_for = cmd->allowed * cmd->timeout_per_command; | ||
1500 | int disposition; | ||
1501 | |||
1502 | INIT_LIST_HEAD(&cmd->eh_entry); | ||
1503 | |||
1504 | disposition = scsi_decide_disposition(cmd); | ||
1505 | if (disposition != SUCCESS && | ||
1506 | time_before(cmd->jiffies_at_alloc + wait_for, jiffies)) { | ||
1507 | sdev_printk(KERN_ERR, cmd->device, | ||
1508 | "timing out command, waited %lus\n", | ||
1509 | wait_for/HZ); | ||
1510 | disposition = SUCCESS; | ||
1511 | } | ||
1512 | |||
1513 | scsi_log_completion(cmd, disposition); | ||
1514 | |||
1515 | switch (disposition) { | ||
1516 | case SUCCESS: | ||
1517 | scsi_finish_command(cmd); | ||
1518 | break; | ||
1519 | case NEEDS_RETRY: | ||
1520 | scsi_retry_command(cmd); | ||
1521 | break; | ||
1522 | case ADD_TO_MLQUEUE: | ||
1523 | scsi_queue_insert(cmd, SCSI_MLQUEUE_DEVICE_BUSY); | ||
1524 | break; | ||
1525 | default: | ||
1526 | if (!scsi_eh_scmd_add(cmd, 0)) | ||
1527 | scsi_finish_command(cmd); | ||
1528 | } | ||
1529 | } | ||
1530 | |||
1496 | /* | 1531 | /* |
1497 | * Function: scsi_request_fn() | 1532 | * Function: scsi_request_fn() |
1498 | * | 1533 | * |
@@ -1667,6 +1702,7 @@ struct request_queue *scsi_alloc_queue(struct scsi_device *sdev) | |||
1667 | blk_queue_bounce_limit(q, scsi_calculate_bounce_limit(shost)); | 1702 | blk_queue_bounce_limit(q, scsi_calculate_bounce_limit(shost)); |
1668 | blk_queue_segment_boundary(q, shost->dma_boundary); | 1703 | blk_queue_segment_boundary(q, shost->dma_boundary); |
1669 | blk_queue_issue_flush_fn(q, scsi_issue_flush_fn); | 1704 | blk_queue_issue_flush_fn(q, scsi_issue_flush_fn); |
1705 | blk_queue_softirq_done(q, scsi_softirq_done); | ||
1670 | 1706 | ||
1671 | if (!shost->use_clustering) | 1707 | if (!shost->use_clustering) |
1672 | clear_bit(QUEUE_FLAG_CLUSTER, &q->queue_flags); | 1708 | clear_bit(QUEUE_FLAG_CLUSTER, &q->queue_flags); |
diff --git a/drivers/scsi/scsi_priv.h b/drivers/scsi/scsi_priv.h index f04e7e11f57a..14a6198cb8d2 100644 --- a/drivers/scsi/scsi_priv.h +++ b/drivers/scsi/scsi_priv.h | |||
@@ -44,6 +44,7 @@ extern void scsi_init_cmd_from_req(struct scsi_cmnd *cmd, | |||
44 | struct scsi_request *sreq); | 44 | struct scsi_request *sreq); |
45 | extern void __scsi_release_request(struct scsi_request *sreq); | 45 | extern void __scsi_release_request(struct scsi_request *sreq); |
46 | extern void __scsi_done(struct scsi_cmnd *cmd); | 46 | extern void __scsi_done(struct scsi_cmnd *cmd); |
47 | extern int scsi_retry_command(struct scsi_cmnd *cmd); | ||
47 | #ifdef CONFIG_SCSI_LOGGING | 48 | #ifdef CONFIG_SCSI_LOGGING |
48 | void scsi_log_send(struct scsi_cmnd *cmd); | 49 | void scsi_log_send(struct scsi_cmnd *cmd); |
49 | void scsi_log_completion(struct scsi_cmnd *cmd, int disposition); | 50 | void scsi_log_completion(struct scsi_cmnd *cmd, int disposition); |
@@ -126,6 +126,7 @@ static void bio_fs_destructor(struct bio *bio) | |||
126 | inline void bio_init(struct bio *bio) | 126 | inline void bio_init(struct bio *bio) |
127 | { | 127 | { |
128 | bio->bi_next = NULL; | 128 | bio->bi_next = NULL; |
129 | bio->bi_bdev = NULL; | ||
129 | bio->bi_flags = 1 << BIO_UPTODATE; | 130 | bio->bi_flags = 1 << BIO_UPTODATE; |
130 | bio->bi_rw = 0; | 131 | bio->bi_rw = 0; |
131 | bio->bi_vcnt = 0; | 132 | bio->bi_vcnt = 0; |
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index fb0985377421..02a585faa62c 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -118,9 +118,9 @@ struct request_list { | |||
118 | * try to put the fields that are referenced together in the same cacheline | 118 | * try to put the fields that are referenced together in the same cacheline |
119 | */ | 119 | */ |
120 | struct request { | 120 | struct request { |
121 | struct list_head queuelist; /* looking for ->queue? you must _not_ | 121 | struct list_head queuelist; |
122 | * access it directly, use | 122 | struct list_head donelist; |
123 | * blkdev_dequeue_request! */ | 123 | |
124 | unsigned long flags; /* see REQ_ bits below */ | 124 | unsigned long flags; /* see REQ_ bits below */ |
125 | 125 | ||
126 | /* Maintain bio traversal state for part by part I/O submission. | 126 | /* Maintain bio traversal state for part by part I/O submission. |
@@ -141,6 +141,7 @@ struct request { | |||
141 | struct bio *biotail; | 141 | struct bio *biotail; |
142 | 142 | ||
143 | void *elevator_private; | 143 | void *elevator_private; |
144 | void *completion_data; | ||
144 | 145 | ||
145 | unsigned short ioprio; | 146 | unsigned short ioprio; |
146 | 147 | ||
@@ -291,6 +292,7 @@ typedef int (merge_bvec_fn) (request_queue_t *, struct bio *, struct bio_vec *); | |||
291 | typedef void (activity_fn) (void *data, int rw); | 292 | typedef void (activity_fn) (void *data, int rw); |
292 | typedef int (issue_flush_fn) (request_queue_t *, struct gendisk *, sector_t *); | 293 | typedef int (issue_flush_fn) (request_queue_t *, struct gendisk *, sector_t *); |
293 | typedef void (prepare_flush_fn) (request_queue_t *, struct request *); | 294 | typedef void (prepare_flush_fn) (request_queue_t *, struct request *); |
295 | typedef void (softirq_done_fn)(struct request *); | ||
294 | 296 | ||
295 | enum blk_queue_state { | 297 | enum blk_queue_state { |
296 | Queue_down, | 298 | Queue_down, |
@@ -332,6 +334,7 @@ struct request_queue | |||
332 | activity_fn *activity_fn; | 334 | activity_fn *activity_fn; |
333 | issue_flush_fn *issue_flush_fn; | 335 | issue_flush_fn *issue_flush_fn; |
334 | prepare_flush_fn *prepare_flush_fn; | 336 | prepare_flush_fn *prepare_flush_fn; |
337 | softirq_done_fn *softirq_done_fn; | ||
335 | 338 | ||
336 | /* | 339 | /* |
337 | * Dispatch queue sorting | 340 | * Dispatch queue sorting |
@@ -592,7 +595,6 @@ extern void generic_make_request(struct bio *bio); | |||
592 | extern void blk_put_request(struct request *); | 595 | extern void blk_put_request(struct request *); |
593 | extern void __blk_put_request(request_queue_t *, struct request *); | 596 | extern void __blk_put_request(request_queue_t *, struct request *); |
594 | extern void blk_end_sync_rq(struct request *rq, int error); | 597 | extern void blk_end_sync_rq(struct request *rq, int error); |
595 | extern void blk_attempt_remerge(request_queue_t *, struct request *); | ||
596 | extern struct request *blk_get_request(request_queue_t *, int, gfp_t); | 598 | extern struct request *blk_get_request(request_queue_t *, int, gfp_t); |
597 | extern void blk_insert_request(request_queue_t *, struct request *, int, void *); | 599 | extern void blk_insert_request(request_queue_t *, struct request *, int, void *); |
598 | extern void blk_requeue_request(request_queue_t *, struct request *); | 600 | extern void blk_requeue_request(request_queue_t *, struct request *); |
@@ -646,6 +648,17 @@ extern int end_that_request_first(struct request *, int, int); | |||
646 | extern int end_that_request_chunk(struct request *, int, int); | 648 | extern int end_that_request_chunk(struct request *, int, int); |
647 | extern void end_that_request_last(struct request *, int); | 649 | extern void end_that_request_last(struct request *, int); |
648 | extern void end_request(struct request *req, int uptodate); | 650 | extern void end_request(struct request *req, int uptodate); |
651 | extern void blk_complete_request(struct request *); | ||
652 | |||
653 | static inline int rq_all_done(struct request *rq, unsigned int nr_bytes) | ||
654 | { | ||
655 | if (blk_fs_request(rq)) | ||
656 | return (nr_bytes >= (rq->hard_nr_sectors << 9)); | ||
657 | else if (blk_pc_request(rq)) | ||
658 | return nr_bytes >= rq->data_len; | ||
659 | |||
660 | return 0; | ||
661 | } | ||
649 | 662 | ||
650 | /* | 663 | /* |
651 | * end_that_request_first/chunk() takes an uptodate argument. we account | 664 | * end_that_request_first/chunk() takes an uptodate argument. we account |
@@ -694,6 +707,7 @@ extern void blk_queue_segment_boundary(request_queue_t *, unsigned long); | |||
694 | extern void blk_queue_prep_rq(request_queue_t *, prep_rq_fn *pfn); | 707 | extern void blk_queue_prep_rq(request_queue_t *, prep_rq_fn *pfn); |
695 | extern void blk_queue_merge_bvec(request_queue_t *, merge_bvec_fn *); | 708 | extern void blk_queue_merge_bvec(request_queue_t *, merge_bvec_fn *); |
696 | extern void blk_queue_dma_alignment(request_queue_t *, int); | 709 | extern void blk_queue_dma_alignment(request_queue_t *, int); |
710 | extern void blk_queue_softirq_done(request_queue_t *, softirq_done_fn *); | ||
697 | extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev); | 711 | extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev); |
698 | extern int blk_queue_ordered(request_queue_t *, unsigned, prepare_flush_fn *); | 712 | extern int blk_queue_ordered(request_queue_t *, unsigned, prepare_flush_fn *); |
699 | extern void blk_queue_issue_flush_fn(request_queue_t *, issue_flush_fn *); | 713 | extern void blk_queue_issue_flush_fn(request_queue_t *, issue_flush_fn *); |
diff --git a/include/linux/elevator.h b/include/linux/elevator.h index fb80fa44c4dd..4a6f50e31c73 100644 --- a/include/linux/elevator.h +++ b/include/linux/elevator.h | |||
@@ -114,8 +114,6 @@ extern ssize_t elv_iosched_store(request_queue_t *, const char *, size_t); | |||
114 | extern int elevator_init(request_queue_t *, char *); | 114 | extern int elevator_init(request_queue_t *, char *); |
115 | extern void elevator_exit(elevator_t *); | 115 | extern void elevator_exit(elevator_t *); |
116 | extern int elv_rq_merge_ok(struct request *, struct bio *); | 116 | extern int elv_rq_merge_ok(struct request *, struct bio *); |
117 | extern int elv_try_merge(struct request *, struct bio *); | ||
118 | extern int elv_try_last_merge(request_queue_t *, struct bio *); | ||
119 | 117 | ||
120 | /* | 118 | /* |
121 | * Return values from elevator merger | 119 | * Return values from elevator merger |
diff --git a/include/linux/ide.h b/include/linux/ide.h index 4dd6694963c0..ef8d0cbb832f 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
@@ -1001,6 +1001,7 @@ extern int noautodma; | |||
1001 | 1001 | ||
1002 | extern int ide_end_request (ide_drive_t *drive, int uptodate, int nrsecs); | 1002 | extern int ide_end_request (ide_drive_t *drive, int uptodate, int nrsecs); |
1003 | extern int __ide_end_request (ide_drive_t *drive, struct request *rq, int uptodate, int nrsecs); | 1003 | extern int __ide_end_request (ide_drive_t *drive, struct request *rq, int uptodate, int nrsecs); |
1004 | extern void ide_softirq_done(struct request *rq); | ||
1004 | 1005 | ||
1005 | /* | 1006 | /* |
1006 | * This is used on exit from the driver to designate the next irq handler | 1007 | * This is used on exit from the driver to designate the next irq handler |
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index e50a95fbeb11..2c08fdc2bdf7 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h | |||
@@ -112,7 +112,7 @@ enum | |||
112 | TIMER_SOFTIRQ, | 112 | TIMER_SOFTIRQ, |
113 | NET_TX_SOFTIRQ, | 113 | NET_TX_SOFTIRQ, |
114 | NET_RX_SOFTIRQ, | 114 | NET_RX_SOFTIRQ, |
115 | SCSI_SOFTIRQ, | 115 | BLOCK_SOFTIRQ, |
116 | TASKLET_SOFTIRQ | 116 | TASKLET_SOFTIRQ |
117 | }; | 117 | }; |
118 | 118 | ||
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index 51747cd88d1a..a1d26cb28925 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h | |||
@@ -125,36 +125,7 @@ static inline void rcu_bh_qsctr_inc(int cpu) | |||
125 | rdp->passed_quiesc = 1; | 125 | rdp->passed_quiesc = 1; |
126 | } | 126 | } |
127 | 127 | ||
128 | static inline int __rcu_pending(struct rcu_ctrlblk *rcp, | 128 | extern int rcu_pending(int cpu); |
129 | struct rcu_data *rdp) | ||
130 | { | ||
131 | /* This cpu has pending rcu entries and the grace period | ||
132 | * for them has completed. | ||
133 | */ | ||
134 | if (rdp->curlist && !rcu_batch_before(rcp->completed, rdp->batch)) | ||
135 | return 1; | ||
136 | |||
137 | /* This cpu has no pending entries, but there are new entries */ | ||
138 | if (!rdp->curlist && rdp->nxtlist) | ||
139 | return 1; | ||
140 | |||
141 | /* This cpu has finished callbacks to invoke */ | ||
142 | if (rdp->donelist) | ||
143 | return 1; | ||
144 | |||
145 | /* The rcu core waits for a quiescent state from the cpu */ | ||
146 | if (rdp->quiescbatch != rcp->cur || rdp->qs_pending) | ||
147 | return 1; | ||
148 | |||
149 | /* nothing to do */ | ||
150 | return 0; | ||
151 | } | ||
152 | |||
153 | static inline int rcu_pending(int cpu) | ||
154 | { | ||
155 | return __rcu_pending(&rcu_ctrlblk, &per_cpu(rcu_data, cpu)) || | ||
156 | __rcu_pending(&rcu_bh_ctrlblk, &per_cpu(rcu_bh_data, cpu)); | ||
157 | } | ||
158 | 129 | ||
159 | /** | 130 | /** |
160 | * rcu_read_lock - mark the beginning of an RCU read-side critical section. | 131 | * rcu_read_lock - mark the beginning of an RCU read-side critical section. |
diff --git a/kernel/rcupdate.c b/kernel/rcupdate.c index 30b0bba03859..ccc45d49ce71 100644 --- a/kernel/rcupdate.c +++ b/kernel/rcupdate.c | |||
@@ -429,6 +429,36 @@ static void rcu_process_callbacks(unsigned long unused) | |||
429 | &__get_cpu_var(rcu_bh_data)); | 429 | &__get_cpu_var(rcu_bh_data)); |
430 | } | 430 | } |
431 | 431 | ||
432 | static int __rcu_pending(struct rcu_ctrlblk *rcp, struct rcu_data *rdp) | ||
433 | { | ||
434 | /* This cpu has pending rcu entries and the grace period | ||
435 | * for them has completed. | ||
436 | */ | ||
437 | if (rdp->curlist && !rcu_batch_before(rcp->completed, rdp->batch)) | ||
438 | return 1; | ||
439 | |||
440 | /* This cpu has no pending entries, but there are new entries */ | ||
441 | if (!rdp->curlist && rdp->nxtlist) | ||
442 | return 1; | ||
443 | |||
444 | /* This cpu has finished callbacks to invoke */ | ||
445 | if (rdp->donelist) | ||
446 | return 1; | ||
447 | |||
448 | /* The rcu core waits for a quiescent state from the cpu */ | ||
449 | if (rdp->quiescbatch != rcp->cur || rdp->qs_pending) | ||
450 | return 1; | ||
451 | |||
452 | /* nothing to do */ | ||
453 | return 0; | ||
454 | } | ||
455 | |||
456 | int rcu_pending(int cpu) | ||
457 | { | ||
458 | return __rcu_pending(&rcu_ctrlblk, &per_cpu(rcu_data, cpu)) || | ||
459 | __rcu_pending(&rcu_bh_ctrlblk, &per_cpu(rcu_bh_data, cpu)); | ||
460 | } | ||
461 | |||
432 | void rcu_check_callbacks(int cpu, int user) | 462 | void rcu_check_callbacks(int cpu, int user) |
433 | { | 463 | { |
434 | if (user || | 464 | if (user || |
diff --git a/net/ieee80211/ieee80211_crypt_wep.c b/net/ieee80211/ieee80211_crypt_wep.c index 073aebdf0f67..f8dca31be5dd 100644 --- a/net/ieee80211/ieee80211_crypt_wep.c +++ b/net/ieee80211/ieee80211_crypt_wep.c | |||
@@ -75,22 +75,14 @@ static void prism2_wep_deinit(void *priv) | |||
75 | kfree(priv); | 75 | kfree(priv); |
76 | } | 76 | } |
77 | 77 | ||
78 | /* Perform WEP encryption on given skb that has at least 4 bytes of headroom | 78 | /* Add WEP IV/key info to a frame that has at least 4 bytes of headroom */ |
79 | * for IV and 4 bytes of tailroom for ICV. Both IV and ICV will be transmitted, | 79 | static int prism2_wep_build_iv(struct sk_buff *skb, int hdr_len, void *priv) |
80 | * so the payload length increases with 8 bytes. | ||
81 | * | ||
82 | * WEP frame payload: IV + TX key idx, RC4(data), ICV = RC4(CRC32(data)) | ||
83 | */ | ||
84 | static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv) | ||
85 | { | 80 | { |
86 | struct prism2_wep_data *wep = priv; | 81 | struct prism2_wep_data *wep = priv; |
87 | u32 crc, klen, len; | 82 | u32 klen, len; |
88 | u8 key[WEP_KEY_LEN + 3]; | 83 | u8 *pos; |
89 | u8 *pos, *icv; | 84 | |
90 | struct scatterlist sg; | 85 | if (skb_headroom(skb) < 4 || skb->len < hdr_len) |
91 | |||
92 | if (skb_headroom(skb) < 4 || skb_tailroom(skb) < 4 || | ||
93 | skb->len < hdr_len) | ||
94 | return -1; | 86 | return -1; |
95 | 87 | ||
96 | len = skb->len - hdr_len; | 88 | len = skb->len - hdr_len; |
@@ -112,15 +104,47 @@ static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
112 | } | 104 | } |
113 | 105 | ||
114 | /* Prepend 24-bit IV to RC4 key and TX frame */ | 106 | /* Prepend 24-bit IV to RC4 key and TX frame */ |
115 | *pos++ = key[0] = (wep->iv >> 16) & 0xff; | 107 | *pos++ = (wep->iv >> 16) & 0xff; |
116 | *pos++ = key[1] = (wep->iv >> 8) & 0xff; | 108 | *pos++ = (wep->iv >> 8) & 0xff; |
117 | *pos++ = key[2] = wep->iv & 0xff; | 109 | *pos++ = wep->iv & 0xff; |
118 | *pos++ = wep->key_idx << 6; | 110 | *pos++ = wep->key_idx << 6; |
119 | 111 | ||
112 | return 0; | ||
113 | } | ||
114 | |||
115 | /* Perform WEP encryption on given skb that has at least 4 bytes of headroom | ||
116 | * for IV and 4 bytes of tailroom for ICV. Both IV and ICV will be transmitted, | ||
117 | * so the payload length increases with 8 bytes. | ||
118 | * | ||
119 | * WEP frame payload: IV + TX key idx, RC4(data), ICV = RC4(CRC32(data)) | ||
120 | */ | ||
121 | static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv) | ||
122 | { | ||
123 | struct prism2_wep_data *wep = priv; | ||
124 | u32 crc, klen, len; | ||
125 | u8 *pos, *icv; | ||
126 | struct scatterlist sg; | ||
127 | u8 key[WEP_KEY_LEN + 3]; | ||
128 | |||
129 | /* other checks are in prism2_wep_build_iv */ | ||
130 | if (skb_tailroom(skb) < 4) | ||
131 | return -1; | ||
132 | |||
133 | /* add the IV to the frame */ | ||
134 | if (prism2_wep_build_iv(skb, hdr_len, priv)) | ||
135 | return -1; | ||
136 | |||
137 | /* Copy the IV into the first 3 bytes of the key */ | ||
138 | memcpy(key, skb->data + hdr_len, 3); | ||
139 | |||
120 | /* Copy rest of the WEP key (the secret part) */ | 140 | /* Copy rest of the WEP key (the secret part) */ |
121 | memcpy(key + 3, wep->key, wep->key_len); | 141 | memcpy(key + 3, wep->key, wep->key_len); |
142 | |||
143 | len = skb->len - hdr_len - 4; | ||
144 | pos = skb->data + hdr_len + 4; | ||
145 | klen = 3 + wep->key_len; | ||
122 | 146 | ||
123 | /* Append little-endian CRC32 and encrypt it to produce ICV */ | 147 | /* Append little-endian CRC32 over only the data and encrypt it to produce ICV */ |
124 | crc = ~crc32_le(~0, pos, len); | 148 | crc = ~crc32_le(~0, pos, len); |
125 | icv = skb_put(skb, 4); | 149 | icv = skb_put(skb, 4); |
126 | icv[0] = crc; | 150 | icv[0] = crc; |
@@ -231,6 +255,7 @@ static struct ieee80211_crypto_ops ieee80211_crypt_wep = { | |||
231 | .name = "WEP", | 255 | .name = "WEP", |
232 | .init = prism2_wep_init, | 256 | .init = prism2_wep_init, |
233 | .deinit = prism2_wep_deinit, | 257 | .deinit = prism2_wep_deinit, |
258 | .build_iv = prism2_wep_build_iv, | ||
234 | .encrypt_mpdu = prism2_wep_encrypt, | 259 | .encrypt_mpdu = prism2_wep_encrypt, |
235 | .decrypt_mpdu = prism2_wep_decrypt, | 260 | .decrypt_mpdu = prism2_wep_decrypt, |
236 | .encrypt_msdu = NULL, | 261 | .encrypt_msdu = NULL, |
diff --git a/net/ieee80211/ieee80211_tx.c b/net/ieee80211/ieee80211_tx.c index 445f206e65e0..e5b33c8d5dbc 100644 --- a/net/ieee80211/ieee80211_tx.c +++ b/net/ieee80211/ieee80211_tx.c | |||
@@ -288,7 +288,7 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) | |||
288 | /* Determine total amount of storage required for TXB packets */ | 288 | /* Determine total amount of storage required for TXB packets */ |
289 | bytes = skb->len + SNAP_SIZE + sizeof(u16); | 289 | bytes = skb->len + SNAP_SIZE + sizeof(u16); |
290 | 290 | ||
291 | if (host_encrypt) | 291 | if (host_encrypt || host_build_iv) |
292 | fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA | | 292 | fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA | |
293 | IEEE80211_FCTL_PROTECTED; | 293 | IEEE80211_FCTL_PROTECTED; |
294 | else | 294 | else |
diff --git a/net/ieee80211/ieee80211_wx.c b/net/ieee80211/ieee80211_wx.c index 181755f2aa8b..406d5b964905 100644 --- a/net/ieee80211/ieee80211_wx.c +++ b/net/ieee80211/ieee80211_wx.c | |||
@@ -284,7 +284,7 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee, | |||
284 | }; | 284 | }; |
285 | int i, key, key_provided, len; | 285 | int i, key, key_provided, len; |
286 | struct ieee80211_crypt_data **crypt; | 286 | struct ieee80211_crypt_data **crypt; |
287 | int host_crypto = ieee->host_encrypt || ieee->host_decrypt; | 287 | int host_crypto = ieee->host_encrypt || ieee->host_decrypt || ieee->host_build_iv; |
288 | 288 | ||
289 | IEEE80211_DEBUG_WX("SET_ENCODE\n"); | 289 | IEEE80211_DEBUG_WX("SET_ENCODE\n"); |
290 | 290 | ||
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index 7849cac14d3a..a67f1b44c9a3 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c | |||
@@ -402,7 +402,7 @@ static int netlink_create(struct socket *sock, int protocol) | |||
402 | groups = nl_table[protocol].groups; | 402 | groups = nl_table[protocol].groups; |
403 | netlink_unlock_table(); | 403 | netlink_unlock_table(); |
404 | 404 | ||
405 | if ((err = __netlink_create(sock, protocol) < 0)) | 405 | if ((err = __netlink_create(sock, protocol)) < 0) |
406 | goto out_module; | 406 | goto out_module; |
407 | 407 | ||
408 | nlk = nlk_sk(sock->sk); | 408 | nlk = nlk_sk(sock->sk); |