diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org.(none)> | 2005-04-19 16:12:03 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org.(none)> | 2005-04-19 16:12:03 -0400 |
commit | c3c661932cd53582c5b03692b99649300977248a (patch) | |
tree | de34eb5c85e5534cc23184622a257f7bddbc4376 /drivers | |
parent | c79bea07ec4d3ef087962699fe8b2f6dc5ca7754 (diff) | |
parent | a4b38364093bf2094ff858ad45f490521bb87984 (diff) |
Merge with kernel.org:/pub/scm/linux/kernel/git/gregkh/aoe-2.6.git/
for 11 aoe bugfix patches.
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/block/aoe/aoe.h | 23 | ||||
-rw-r--r-- | drivers/block/aoe/aoeblk.c | 5 | ||||
-rw-r--r-- | drivers/block/aoe/aoecmd.c | 108 | ||||
-rw-r--r-- | drivers/block/aoe/aoedev.c | 8 | ||||
-rw-r--r-- | drivers/block/aoe/aoenet.c | 8 |
5 files changed, 89 insertions, 63 deletions
diff --git a/drivers/block/aoe/aoe.h b/drivers/block/aoe/aoe.h index db78f826d40c..aa8b547ffafa 100644 --- a/drivers/block/aoe/aoe.h +++ b/drivers/block/aoe/aoe.h | |||
@@ -1,10 +1,15 @@ | |||
1 | /* Copyright (c) 2004 Coraid, Inc. See COPYING for GPL terms. */ | 1 | /* Copyright (c) 2004 Coraid, Inc. See COPYING for GPL terms. */ |
2 | #define VERSION "5" | 2 | #define VERSION "6" |
3 | #define AOE_MAJOR 152 | 3 | #define AOE_MAJOR 152 |
4 | #define DEVICE_NAME "aoe" | 4 | #define DEVICE_NAME "aoe" |
5 | |||
6 | /* set AOE_PARTITIONS to 1 to use whole-disks only | ||
7 | * default is 16, which is 15 partitions plus the whole disk | ||
8 | */ | ||
5 | #ifndef AOE_PARTITIONS | 9 | #ifndef AOE_PARTITIONS |
6 | #define AOE_PARTITIONS 16 | 10 | #define AOE_PARTITIONS 16 |
7 | #endif | 11 | #endif |
12 | |||
8 | #define SYSMINOR(aoemajor, aoeminor) ((aoemajor) * 10 + (aoeminor)) | 13 | #define SYSMINOR(aoemajor, aoeminor) ((aoemajor) * 10 + (aoeminor)) |
9 | #define AOEMAJOR(sysminor) ((sysminor) / 10) | 14 | #define AOEMAJOR(sysminor) ((sysminor) / 10) |
10 | #define AOEMINOR(sysminor) ((sysminor) % 10) | 15 | #define AOEMINOR(sysminor) ((sysminor) % 10) |
@@ -34,13 +39,13 @@ enum { | |||
34 | struct aoe_hdr { | 39 | struct aoe_hdr { |
35 | unsigned char dst[6]; | 40 | unsigned char dst[6]; |
36 | unsigned char src[6]; | 41 | unsigned char src[6]; |
37 | unsigned char type[2]; | 42 | __be16 type; |
38 | unsigned char verfl; | 43 | unsigned char verfl; |
39 | unsigned char err; | 44 | unsigned char err; |
40 | unsigned char major[2]; | 45 | __be16 major; |
41 | unsigned char minor; | 46 | unsigned char minor; |
42 | unsigned char cmd; | 47 | unsigned char cmd; |
43 | unsigned char tag[4]; | 48 | __be32 tag; |
44 | }; | 49 | }; |
45 | 50 | ||
46 | struct aoe_atahdr { | 51 | struct aoe_atahdr { |
@@ -58,8 +63,8 @@ struct aoe_atahdr { | |||
58 | }; | 63 | }; |
59 | 64 | ||
60 | struct aoe_cfghdr { | 65 | struct aoe_cfghdr { |
61 | unsigned char bufcnt[2]; | 66 | __be16 bufcnt; |
62 | unsigned char fwver[2]; | 67 | __be16 fwver; |
63 | unsigned char res; | 68 | unsigned char res; |
64 | unsigned char aoeccmd; | 69 | unsigned char aoeccmd; |
65 | unsigned char cslen[2]; | 70 | unsigned char cslen[2]; |
@@ -85,6 +90,7 @@ enum { | |||
85 | 90 | ||
86 | struct buf { | 91 | struct buf { |
87 | struct list_head bufs; | 92 | struct list_head bufs; |
93 | ulong start_time; /* for disk stats */ | ||
88 | ulong flags; | 94 | ulong flags; |
89 | ulong nframesout; | 95 | ulong nframesout; |
90 | char *bufaddr; | 96 | char *bufaddr; |
@@ -125,7 +131,8 @@ struct aoedev { | |||
125 | struct timer_list timer; | 131 | struct timer_list timer; |
126 | spinlock_t lock; | 132 | spinlock_t lock; |
127 | struct net_device *ifp; /* interface ed is attached to */ | 133 | struct net_device *ifp; /* interface ed is attached to */ |
128 | struct sk_buff *skblist;/* packets needing to be sent */ | 134 | struct sk_buff *sendq_hd; /* packets needing to be sent, list head */ |
135 | struct sk_buff *sendq_tl; | ||
129 | mempool_t *bufpool; /* for deadlock-free Buf allocation */ | 136 | mempool_t *bufpool; /* for deadlock-free Buf allocation */ |
130 | struct list_head bufq; /* queue of bios to work on */ | 137 | struct list_head bufq; /* queue of bios to work on */ |
131 | struct buf *inprocess; /* the one we're currently working on */ | 138 | struct buf *inprocess; /* the one we're currently working on */ |
@@ -151,7 +158,7 @@ void aoecmd_cfg_rsp(struct sk_buff *); | |||
151 | 158 | ||
152 | int aoedev_init(void); | 159 | int aoedev_init(void); |
153 | void aoedev_exit(void); | 160 | void aoedev_exit(void); |
154 | struct aoedev *aoedev_bymac(unsigned char *); | 161 | struct aoedev *aoedev_by_aoeaddr(int maj, int min); |
155 | void aoedev_downdev(struct aoedev *d); | 162 | void aoedev_downdev(struct aoedev *d); |
156 | struct aoedev *aoedev_set(ulong, unsigned char *, struct net_device *, ulong); | 163 | struct aoedev *aoedev_set(ulong, unsigned char *, struct net_device *, ulong); |
157 | int aoedev_busy(void); | 164 | int aoedev_busy(void); |
diff --git a/drivers/block/aoe/aoeblk.c b/drivers/block/aoe/aoeblk.c index 63561b280bc5..4780f7926d42 100644 --- a/drivers/block/aoe/aoeblk.c +++ b/drivers/block/aoe/aoeblk.c | |||
@@ -125,6 +125,7 @@ aoeblk_make_request(request_queue_t *q, struct bio *bio) | |||
125 | } | 125 | } |
126 | memset(buf, 0, sizeof(*buf)); | 126 | memset(buf, 0, sizeof(*buf)); |
127 | INIT_LIST_HEAD(&buf->bufs); | 127 | INIT_LIST_HEAD(&buf->bufs); |
128 | buf->start_time = jiffies; | ||
128 | buf->bio = bio; | 129 | buf->bio = bio; |
129 | buf->resid = bio->bi_size; | 130 | buf->resid = bio->bi_size; |
130 | buf->sector = bio->bi_sector; | 131 | buf->sector = bio->bi_sector; |
@@ -146,8 +147,8 @@ aoeblk_make_request(request_queue_t *q, struct bio *bio) | |||
146 | list_add_tail(&buf->bufs, &d->bufq); | 147 | list_add_tail(&buf->bufs, &d->bufq); |
147 | aoecmd_work(d); | 148 | aoecmd_work(d); |
148 | 149 | ||
149 | sl = d->skblist; | 150 | sl = d->sendq_hd; |
150 | d->skblist = NULL; | 151 | d->sendq_hd = d->sendq_tl = NULL; |
151 | 152 | ||
152 | spin_unlock_irqrestore(&d->lock, flags); | 153 | spin_unlock_irqrestore(&d->lock, flags); |
153 | 154 | ||
diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c index fb6d942a4565..b5be4b7d7b5b 100644 --- a/drivers/block/aoe/aoecmd.c +++ b/drivers/block/aoe/aoecmd.c | |||
@@ -90,19 +90,16 @@ newtag(struct aoedev *d) | |||
90 | static int | 90 | static int |
91 | aoehdr_atainit(struct aoedev *d, struct aoe_hdr *h) | 91 | aoehdr_atainit(struct aoedev *d, struct aoe_hdr *h) |
92 | { | 92 | { |
93 | u16 type = __constant_cpu_to_be16(ETH_P_AOE); | ||
94 | u16 aoemajor = __cpu_to_be16(d->aoemajor); | ||
95 | u32 host_tag = newtag(d); | 93 | u32 host_tag = newtag(d); |
96 | u32 tag = __cpu_to_be32(host_tag); | ||
97 | 94 | ||
98 | memcpy(h->src, d->ifp->dev_addr, sizeof h->src); | 95 | memcpy(h->src, d->ifp->dev_addr, sizeof h->src); |
99 | memcpy(h->dst, d->addr, sizeof h->dst); | 96 | memcpy(h->dst, d->addr, sizeof h->dst); |
100 | memcpy(h->type, &type, sizeof type); | 97 | h->type = __constant_cpu_to_be16(ETH_P_AOE); |
101 | h->verfl = AOE_HVER; | 98 | h->verfl = AOE_HVER; |
102 | memcpy(h->major, &aoemajor, sizeof aoemajor); | 99 | h->major = cpu_to_be16(d->aoemajor); |
103 | h->minor = d->aoeminor; | 100 | h->minor = d->aoeminor; |
104 | h->cmd = AOECMD_ATA; | 101 | h->cmd = AOECMD_ATA; |
105 | memcpy(h->tag, &tag, sizeof tag); | 102 | h->tag = cpu_to_be32(host_tag); |
106 | 103 | ||
107 | return host_tag; | 104 | return host_tag; |
108 | } | 105 | } |
@@ -181,8 +178,12 @@ aoecmd_ata_rw(struct aoedev *d, struct frame *f) | |||
181 | 178 | ||
182 | skb = skb_prepare(d, f); | 179 | skb = skb_prepare(d, f); |
183 | if (skb) { | 180 | if (skb) { |
184 | skb->next = d->skblist; | 181 | skb->next = NULL; |
185 | d->skblist = skb; | 182 | if (d->sendq_hd) |
183 | d->sendq_tl->next = skb; | ||
184 | else | ||
185 | d->sendq_hd = skb; | ||
186 | d->sendq_tl = skb; | ||
186 | } | 187 | } |
187 | } | 188 | } |
188 | 189 | ||
@@ -215,7 +216,6 @@ rexmit(struct aoedev *d, struct frame *f) | |||
215 | struct aoe_hdr *h; | 216 | struct aoe_hdr *h; |
216 | char buf[128]; | 217 | char buf[128]; |
217 | u32 n; | 218 | u32 n; |
218 | u32 net_tag; | ||
219 | 219 | ||
220 | n = newtag(d); | 220 | n = newtag(d); |
221 | 221 | ||
@@ -227,13 +227,16 @@ rexmit(struct aoedev *d, struct frame *f) | |||
227 | 227 | ||
228 | h = (struct aoe_hdr *) f->data; | 228 | h = (struct aoe_hdr *) f->data; |
229 | f->tag = n; | 229 | f->tag = n; |
230 | net_tag = __cpu_to_be32(n); | 230 | h->tag = cpu_to_be32(n); |
231 | memcpy(h->tag, &net_tag, sizeof net_tag); | ||
232 | 231 | ||
233 | skb = skb_prepare(d, f); | 232 | skb = skb_prepare(d, f); |
234 | if (skb) { | 233 | if (skb) { |
235 | skb->next = d->skblist; | 234 | skb->next = NULL; |
236 | d->skblist = skb; | 235 | if (d->sendq_hd) |
236 | d->sendq_tl->next = skb; | ||
237 | else | ||
238 | d->sendq_hd = skb; | ||
239 | d->sendq_tl = skb; | ||
237 | } | 240 | } |
238 | } | 241 | } |
239 | 242 | ||
@@ -285,8 +288,8 @@ tdie: spin_unlock_irqrestore(&d->lock, flags); | |||
285 | } | 288 | } |
286 | } | 289 | } |
287 | 290 | ||
288 | sl = d->skblist; | 291 | sl = d->sendq_hd; |
289 | d->skblist = NULL; | 292 | d->sendq_hd = d->sendq_tl = NULL; |
290 | if (sl) { | 293 | if (sl) { |
291 | n = d->rttavg <<= 1; | 294 | n = d->rttavg <<= 1; |
292 | if (n > MAXTIMER) | 295 | if (n > MAXTIMER) |
@@ -308,16 +311,16 @@ ataid_complete(struct aoedev *d, unsigned char *id) | |||
308 | u16 n; | 311 | u16 n; |
309 | 312 | ||
310 | /* word 83: command set supported */ | 313 | /* word 83: command set supported */ |
311 | n = __le16_to_cpu(*((u16 *) &id[83<<1])); | 314 | n = le16_to_cpup((__le16 *) &id[83<<1]); |
312 | 315 | ||
313 | /* word 86: command set/feature enabled */ | 316 | /* word 86: command set/feature enabled */ |
314 | n |= __le16_to_cpu(*((u16 *) &id[86<<1])); | 317 | n |= le16_to_cpup((__le16 *) &id[86<<1]); |
315 | 318 | ||
316 | if (n & (1<<10)) { /* bit 10: LBA 48 */ | 319 | if (n & (1<<10)) { /* bit 10: LBA 48 */ |
317 | d->flags |= DEVFL_EXT; | 320 | d->flags |= DEVFL_EXT; |
318 | 321 | ||
319 | /* word 100: number lba48 sectors */ | 322 | /* word 100: number lba48 sectors */ |
320 | ssize = __le64_to_cpu(*((u64 *) &id[100<<1])); | 323 | ssize = le64_to_cpup((__le64 *) &id[100<<1]); |
321 | 324 | ||
322 | /* set as in ide-disk.c:init_idedisk_capacity */ | 325 | /* set as in ide-disk.c:init_idedisk_capacity */ |
323 | d->geo.cylinders = ssize; | 326 | d->geo.cylinders = ssize; |
@@ -328,12 +331,12 @@ ataid_complete(struct aoedev *d, unsigned char *id) | |||
328 | d->flags &= ~DEVFL_EXT; | 331 | d->flags &= ~DEVFL_EXT; |
329 | 332 | ||
330 | /* number lba28 sectors */ | 333 | /* number lba28 sectors */ |
331 | ssize = __le32_to_cpu(*((u32 *) &id[60<<1])); | 334 | ssize = le32_to_cpup((__le32 *) &id[60<<1]); |
332 | 335 | ||
333 | /* NOTE: obsolete in ATA 6 */ | 336 | /* NOTE: obsolete in ATA 6 */ |
334 | d->geo.cylinders = __le16_to_cpu(*((u16 *) &id[54<<1])); | 337 | d->geo.cylinders = le16_to_cpup((__le16 *) &id[54<<1]); |
335 | d->geo.heads = __le16_to_cpu(*((u16 *) &id[55<<1])); | 338 | d->geo.heads = le16_to_cpup((__le16 *) &id[55<<1]); |
336 | d->geo.sectors = __le16_to_cpu(*((u16 *) &id[56<<1])); | 339 | d->geo.sectors = le16_to_cpup((__le16 *) &id[56<<1]); |
337 | } | 340 | } |
338 | d->ssize = ssize; | 341 | d->ssize = ssize; |
339 | d->geo.start = 0; | 342 | d->geo.start = 0; |
@@ -380,29 +383,30 @@ aoecmd_ata_rsp(struct sk_buff *skb) | |||
380 | register long n; | 383 | register long n; |
381 | ulong flags; | 384 | ulong flags; |
382 | char ebuf[128]; | 385 | char ebuf[128]; |
383 | 386 | u16 aoemajor; | |
387 | |||
384 | hin = (struct aoe_hdr *) skb->mac.raw; | 388 | hin = (struct aoe_hdr *) skb->mac.raw; |
385 | d = aoedev_bymac(hin->src); | 389 | aoemajor = be16_to_cpu(hin->major); |
390 | d = aoedev_by_aoeaddr(aoemajor, hin->minor); | ||
386 | if (d == NULL) { | 391 | if (d == NULL) { |
387 | snprintf(ebuf, sizeof ebuf, "aoecmd_ata_rsp: ata response " | 392 | snprintf(ebuf, sizeof ebuf, "aoecmd_ata_rsp: ata response " |
388 | "for unknown device %d.%d\n", | 393 | "for unknown device %d.%d\n", |
389 | __be16_to_cpu(*((u16 *) hin->major)), | 394 | aoemajor, hin->minor); |
390 | hin->minor); | ||
391 | aoechr_error(ebuf); | 395 | aoechr_error(ebuf); |
392 | return; | 396 | return; |
393 | } | 397 | } |
394 | 398 | ||
395 | spin_lock_irqsave(&d->lock, flags); | 399 | spin_lock_irqsave(&d->lock, flags); |
396 | 400 | ||
397 | f = getframe(d, __be32_to_cpu(*((u32 *) hin->tag))); | 401 | f = getframe(d, be32_to_cpu(hin->tag)); |
398 | if (f == NULL) { | 402 | if (f == NULL) { |
399 | spin_unlock_irqrestore(&d->lock, flags); | 403 | spin_unlock_irqrestore(&d->lock, flags); |
400 | snprintf(ebuf, sizeof ebuf, | 404 | snprintf(ebuf, sizeof ebuf, |
401 | "%15s e%d.%d tag=%08x@%08lx\n", | 405 | "%15s e%d.%d tag=%08x@%08lx\n", |
402 | "unexpected rsp", | 406 | "unexpected rsp", |
403 | __be16_to_cpu(*((u16 *) hin->major)), | 407 | be16_to_cpu(hin->major), |
404 | hin->minor, | 408 | hin->minor, |
405 | __be32_to_cpu(*((u32 *) hin->tag)), | 409 | be32_to_cpu(hin->tag), |
406 | jiffies); | 410 | jiffies); |
407 | aoechr_error(ebuf); | 411 | aoechr_error(ebuf); |
408 | return; | 412 | return; |
@@ -452,7 +456,7 @@ aoecmd_ata_rsp(struct sk_buff *skb) | |||
452 | printk(KERN_INFO "aoe: aoecmd_ata_rsp: unrecognized " | 456 | printk(KERN_INFO "aoe: aoecmd_ata_rsp: unrecognized " |
453 | "outbound ata command %2.2Xh for %d.%d\n", | 457 | "outbound ata command %2.2Xh for %d.%d\n", |
454 | ahout->cmdstat, | 458 | ahout->cmdstat, |
455 | __be16_to_cpu(*((u16 *) hin->major)), | 459 | be16_to_cpu(hin->major), |
456 | hin->minor); | 460 | hin->minor); |
457 | } | 461 | } |
458 | } | 462 | } |
@@ -460,6 +464,20 @@ aoecmd_ata_rsp(struct sk_buff *skb) | |||
460 | if (buf) { | 464 | if (buf) { |
461 | buf->nframesout -= 1; | 465 | buf->nframesout -= 1; |
462 | if (buf->nframesout == 0 && buf->resid == 0) { | 466 | if (buf->nframesout == 0 && buf->resid == 0) { |
467 | unsigned long duration = jiffies - buf->start_time; | ||
468 | unsigned long n_sect = buf->bio->bi_size >> 9; | ||
469 | struct gendisk *disk = d->gd; | ||
470 | |||
471 | if (bio_data_dir(buf->bio) == WRITE) { | ||
472 | disk_stat_inc(disk, writes); | ||
473 | disk_stat_add(disk, write_ticks, duration); | ||
474 | disk_stat_add(disk, write_sectors, n_sect); | ||
475 | } else { | ||
476 | disk_stat_inc(disk, reads); | ||
477 | disk_stat_add(disk, read_ticks, duration); | ||
478 | disk_stat_add(disk, read_sectors, n_sect); | ||
479 | } | ||
480 | disk_stat_add(disk, io_ticks, duration); | ||
463 | n = (buf->flags & BUFFL_FAIL) ? -EIO : 0; | 481 | n = (buf->flags & BUFFL_FAIL) ? -EIO : 0; |
464 | bio_endio(buf->bio, buf->bio->bi_size, n); | 482 | bio_endio(buf->bio, buf->bio->bi_size, n); |
465 | mempool_free(buf, d->bufpool); | 483 | mempool_free(buf, d->bufpool); |
@@ -471,8 +489,8 @@ aoecmd_ata_rsp(struct sk_buff *skb) | |||
471 | 489 | ||
472 | aoecmd_work(d); | 490 | aoecmd_work(d); |
473 | 491 | ||
474 | sl = d->skblist; | 492 | sl = d->sendq_hd; |
475 | d->skblist = NULL; | 493 | d->sendq_hd = d->sendq_tl = NULL; |
476 | 494 | ||
477 | spin_unlock_irqrestore(&d->lock, flags); | 495 | spin_unlock_irqrestore(&d->lock, flags); |
478 | 496 | ||
@@ -486,8 +504,6 @@ aoecmd_cfg(ushort aoemajor, unsigned char aoeminor) | |||
486 | struct aoe_cfghdr *ch; | 504 | struct aoe_cfghdr *ch; |
487 | struct sk_buff *skb, *sl; | 505 | struct sk_buff *skb, *sl; |
488 | struct net_device *ifp; | 506 | struct net_device *ifp; |
489 | u16 aoe_type = __constant_cpu_to_be16(ETH_P_AOE); | ||
490 | u16 net_aoemajor = __cpu_to_be16(aoemajor); | ||
491 | 507 | ||
492 | sl = NULL; | 508 | sl = NULL; |
493 | 509 | ||
@@ -507,9 +523,9 @@ aoecmd_cfg(ushort aoemajor, unsigned char aoeminor) | |||
507 | 523 | ||
508 | memset(h->dst, 0xff, sizeof h->dst); | 524 | memset(h->dst, 0xff, sizeof h->dst); |
509 | memcpy(h->src, ifp->dev_addr, sizeof h->src); | 525 | memcpy(h->src, ifp->dev_addr, sizeof h->src); |
510 | memcpy(h->type, &aoe_type, sizeof aoe_type); | 526 | h->type = __constant_cpu_to_be16(ETH_P_AOE); |
511 | h->verfl = AOE_HVER; | 527 | h->verfl = AOE_HVER; |
512 | memcpy(h->major, &net_aoemajor, sizeof net_aoemajor); | 528 | h->major = cpu_to_be16(aoemajor); |
513 | h->minor = aoeminor; | 529 | h->minor = aoeminor; |
514 | h->cmd = AOECMD_CFG; | 530 | h->cmd = AOECMD_CFG; |
515 | 531 | ||
@@ -523,7 +539,7 @@ aoecmd_cfg(ushort aoemajor, unsigned char aoeminor) | |||
523 | 539 | ||
524 | /* | 540 | /* |
525 | * Since we only call this in one place (and it only prepares one frame) | 541 | * Since we only call this in one place (and it only prepares one frame) |
526 | * we just return the skb. Usually we'd chain it up to the d->skblist. | 542 | * we just return the skb. Usually we'd chain it up to the aoedev sendq. |
527 | */ | 543 | */ |
528 | static struct sk_buff * | 544 | static struct sk_buff * |
529 | aoecmd_ata_id(struct aoedev *d) | 545 | aoecmd_ata_id(struct aoedev *d) |
@@ -575,9 +591,10 @@ aoecmd_cfg_rsp(struct sk_buff *skb) | |||
575 | struct aoedev *d; | 591 | struct aoedev *d; |
576 | struct aoe_hdr *h; | 592 | struct aoe_hdr *h; |
577 | struct aoe_cfghdr *ch; | 593 | struct aoe_cfghdr *ch; |
578 | ulong flags, bufcnt, sysminor, aoemajor; | 594 | ulong flags, sysminor, aoemajor; |
595 | u16 bufcnt; | ||
579 | struct sk_buff *sl; | 596 | struct sk_buff *sl; |
580 | enum { MAXFRAMES = 8, MAXSYSMINOR = 255 }; | 597 | enum { MAXFRAMES = 8 }; |
581 | 598 | ||
582 | h = (struct aoe_hdr *) skb->mac.raw; | 599 | h = (struct aoe_hdr *) skb->mac.raw; |
583 | ch = (struct aoe_cfghdr *) (h+1); | 600 | ch = (struct aoe_cfghdr *) (h+1); |
@@ -586,7 +603,7 @@ aoecmd_cfg_rsp(struct sk_buff *skb) | |||
586 | * Enough people have their dip switches set backwards to | 603 | * Enough people have their dip switches set backwards to |
587 | * warrant a loud message for this special case. | 604 | * warrant a loud message for this special case. |
588 | */ | 605 | */ |
589 | aoemajor = __be16_to_cpu(*((u16 *) h->major)); | 606 | aoemajor = be16_to_cpu(h->major); |
590 | if (aoemajor == 0xfff) { | 607 | if (aoemajor == 0xfff) { |
591 | printk(KERN_CRIT "aoe: aoecmd_cfg_rsp: Warning: shelf " | 608 | printk(KERN_CRIT "aoe: aoecmd_cfg_rsp: Warning: shelf " |
592 | "address is all ones. Check shelf dip switches\n"); | 609 | "address is all ones. Check shelf dip switches\n"); |
@@ -594,13 +611,14 @@ aoecmd_cfg_rsp(struct sk_buff *skb) | |||
594 | } | 611 | } |
595 | 612 | ||
596 | sysminor = SYSMINOR(aoemajor, h->minor); | 613 | sysminor = SYSMINOR(aoemajor, h->minor); |
597 | if (sysminor > MAXSYSMINOR) { | 614 | if (sysminor * AOE_PARTITIONS + AOE_PARTITIONS > MINORMASK) { |
598 | printk(KERN_INFO "aoe: aoecmd_cfg_rsp: sysminor %ld too " | 615 | printk(KERN_INFO |
599 | "large\n", sysminor); | 616 | "aoe: e%ld.%d: minor number too large\n", |
617 | aoemajor, (int) h->minor); | ||
600 | return; | 618 | return; |
601 | } | 619 | } |
602 | 620 | ||
603 | bufcnt = __be16_to_cpu(*((u16 *) ch->bufcnt)); | 621 | bufcnt = be16_to_cpu(ch->bufcnt); |
604 | if (bufcnt > MAXFRAMES) /* keep it reasonable */ | 622 | if (bufcnt > MAXFRAMES) /* keep it reasonable */ |
605 | bufcnt = MAXFRAMES; | 623 | bufcnt = MAXFRAMES; |
606 | 624 | ||
@@ -617,7 +635,7 @@ aoecmd_cfg_rsp(struct sk_buff *skb) | |||
617 | return; | 635 | return; |
618 | } | 636 | } |
619 | 637 | ||
620 | d->fw_ver = __be16_to_cpu(*((u16 *) ch->fwver)); | 638 | d->fw_ver = be16_to_cpu(ch->fwver); |
621 | 639 | ||
622 | /* we get here only if the device is new */ | 640 | /* we get here only if the device is new */ |
623 | sl = aoecmd_ata_id(d); | 641 | sl = aoecmd_ata_id(d); |
diff --git a/drivers/block/aoe/aoedev.c b/drivers/block/aoe/aoedev.c index 240abaec159b..ec16c64dd114 100644 --- a/drivers/block/aoe/aoedev.c +++ b/drivers/block/aoe/aoedev.c | |||
@@ -13,7 +13,7 @@ static struct aoedev *devlist; | |||
13 | static spinlock_t devlist_lock; | 13 | static spinlock_t devlist_lock; |
14 | 14 | ||
15 | struct aoedev * | 15 | struct aoedev * |
16 | aoedev_bymac(unsigned char *macaddr) | 16 | aoedev_by_aoeaddr(int maj, int min) |
17 | { | 17 | { |
18 | struct aoedev *d; | 18 | struct aoedev *d; |
19 | ulong flags; | 19 | ulong flags; |
@@ -21,7 +21,7 @@ aoedev_bymac(unsigned char *macaddr) | |||
21 | spin_lock_irqsave(&devlist_lock, flags); | 21 | spin_lock_irqsave(&devlist_lock, flags); |
22 | 22 | ||
23 | for (d=devlist; d; d=d->next) | 23 | for (d=devlist; d; d=d->next) |
24 | if (!memcmp(d->addr, macaddr, 6)) | 24 | if (d->aoemajor == maj && d->aoeminor == min) |
25 | break; | 25 | break; |
26 | 26 | ||
27 | spin_unlock_irqrestore(&devlist_lock, flags); | 27 | spin_unlock_irqrestore(&devlist_lock, flags); |
@@ -125,7 +125,6 @@ aoedev_set(ulong sysminor, unsigned char *addr, struct net_device *ifp, ulong bu | |||
125 | d->ifp = ifp; | 125 | d->ifp = ifp; |
126 | 126 | ||
127 | if (d->sysminor != sysminor | 127 | if (d->sysminor != sysminor |
128 | || memcmp(d->addr, addr, sizeof d->addr) | ||
129 | || (d->flags & DEVFL_UP) == 0) { | 128 | || (d->flags & DEVFL_UP) == 0) { |
130 | aoedev_downdev(d); /* flushes outstanding frames */ | 129 | aoedev_downdev(d); /* flushes outstanding frames */ |
131 | memcpy(d->addr, addr, sizeof d->addr); | 130 | memcpy(d->addr, addr, sizeof d->addr); |
@@ -147,7 +146,8 @@ aoedev_freedev(struct aoedev *d) | |||
147 | put_disk(d->gd); | 146 | put_disk(d->gd); |
148 | } | 147 | } |
149 | kfree(d->frames); | 148 | kfree(d->frames); |
150 | mempool_destroy(d->bufpool); | 149 | if (d->bufpool) |
150 | mempool_destroy(d->bufpool); | ||
151 | kfree(d); | 151 | kfree(d); |
152 | } | 152 | } |
153 | 153 | ||
diff --git a/drivers/block/aoe/aoenet.c b/drivers/block/aoe/aoenet.c index cc1945b8d52b..bc92aacb6dad 100644 --- a/drivers/block/aoe/aoenet.c +++ b/drivers/block/aoe/aoenet.c | |||
@@ -69,7 +69,7 @@ set_aoe_iflist(const char __user *user_str, size_t size) | |||
69 | u64 | 69 | u64 |
70 | mac_addr(char addr[6]) | 70 | mac_addr(char addr[6]) |
71 | { | 71 | { |
72 | u64 n = 0; | 72 | __be64 n = 0; |
73 | char *p = (char *) &n; | 73 | char *p = (char *) &n; |
74 | 74 | ||
75 | memcpy(p + 2, addr, 6); /* (sizeof addr != 6) */ | 75 | memcpy(p + 2, addr, 6); /* (sizeof addr != 6) */ |
@@ -108,7 +108,7 @@ static int | |||
108 | aoenet_rcv(struct sk_buff *skb, struct net_device *ifp, struct packet_type *pt) | 108 | aoenet_rcv(struct sk_buff *skb, struct net_device *ifp, struct packet_type *pt) |
109 | { | 109 | { |
110 | struct aoe_hdr *h; | 110 | struct aoe_hdr *h; |
111 | ulong n; | 111 | u32 n; |
112 | 112 | ||
113 | skb = skb_check(skb); | 113 | skb = skb_check(skb); |
114 | if (!skb) | 114 | if (!skb) |
@@ -121,7 +121,7 @@ aoenet_rcv(struct sk_buff *skb, struct net_device *ifp, struct packet_type *pt) | |||
121 | skb_push(skb, ETH_HLEN); /* (1) */ | 121 | skb_push(skb, ETH_HLEN); /* (1) */ |
122 | 122 | ||
123 | h = (struct aoe_hdr *) skb->mac.raw; | 123 | h = (struct aoe_hdr *) skb->mac.raw; |
124 | n = __be32_to_cpu(*((u32 *) h->tag)); | 124 | n = be32_to_cpu(h->tag); |
125 | if ((h->verfl & AOEFL_RSP) == 0 || (n & 1<<31)) | 125 | if ((h->verfl & AOEFL_RSP) == 0 || (n & 1<<31)) |
126 | goto exit; | 126 | goto exit; |
127 | 127 | ||
@@ -132,7 +132,7 @@ aoenet_rcv(struct sk_buff *skb, struct net_device *ifp, struct packet_type *pt) | |||
132 | if (net_ratelimit()) | 132 | if (net_ratelimit()) |
133 | printk(KERN_ERR "aoe: aoenet_rcv: error packet from %d.%d; " | 133 | printk(KERN_ERR "aoe: aoenet_rcv: error packet from %d.%d; " |
134 | "ecode=%d '%s'\n", | 134 | "ecode=%d '%s'\n", |
135 | __be16_to_cpu(*((u16 *) h->major)), h->minor, | 135 | be16_to_cpu(h->major), h->minor, |
136 | h->err, aoe_errlist[n]); | 136 | h->err, aoe_errlist[n]); |
137 | goto exit; | 137 | goto exit; |
138 | } | 138 | } |