aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/block/aoe/aoe.h10
-rw-r--r--drivers/block/aoe/aoecmd.c52
-rw-r--r--drivers/block/aoe/aoenet.c8
3 files changed, 32 insertions, 38 deletions
diff --git a/drivers/block/aoe/aoe.h b/drivers/block/aoe/aoe.h
index cb5dca3ce9f5..d3b0e2ca151a 100644
--- a/drivers/block/aoe/aoe.h
+++ b/drivers/block/aoe/aoe.h
@@ -39,13 +39,13 @@ enum {
39struct aoe_hdr { 39struct aoe_hdr {
40 unsigned char dst[6]; 40 unsigned char dst[6];
41 unsigned char src[6]; 41 unsigned char src[6];
42 unsigned char type[2]; 42 __be16 type;
43 unsigned char verfl; 43 unsigned char verfl;
44 unsigned char err; 44 unsigned char err;
45 unsigned char major[2]; 45 __be16 major;
46 unsigned char minor; 46 unsigned char minor;
47 unsigned char cmd; 47 unsigned char cmd;
48 unsigned char tag[4]; 48 __be32 tag;
49}; 49};
50 50
51struct aoe_atahdr { 51struct aoe_atahdr {
@@ -63,8 +63,8 @@ struct aoe_atahdr {
63}; 63};
64 64
65struct aoe_cfghdr { 65struct aoe_cfghdr {
66 unsigned char bufcnt[2]; 66 __be16 bufcnt;
67 unsigned char fwver[2]; 67 __be16 fwver;
68 unsigned char res; 68 unsigned char res;
69 unsigned char aoeccmd; 69 unsigned char aoeccmd;
70 unsigned char cslen[2]; 70 unsigned char cslen[2];
diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c
index 5d437697c368..f810bd6bf87f 100644
--- a/drivers/block/aoe/aoecmd.c
+++ b/drivers/block/aoe/aoecmd.c
@@ -90,19 +90,16 @@ newtag(struct aoedev *d)
90static int 90static int
91aoehdr_atainit(struct aoedev *d, struct aoe_hdr *h) 91aoehdr_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}
@@ -215,7 +212,6 @@ rexmit(struct aoedev *d, struct frame *f)
215 struct aoe_hdr *h; 212 struct aoe_hdr *h;
216 char buf[128]; 213 char buf[128];
217 u32 n; 214 u32 n;
218 u32 net_tag;
219 215
220 n = newtag(d); 216 n = newtag(d);
221 217
@@ -227,8 +223,7 @@ rexmit(struct aoedev *d, struct frame *f)
227 223
228 h = (struct aoe_hdr *) f->data; 224 h = (struct aoe_hdr *) f->data;
229 f->tag = n; 225 f->tag = n;
230 net_tag = __cpu_to_be32(n); 226 h->tag = cpu_to_be32(n);
231 memcpy(h->tag, &net_tag, sizeof net_tag);
232 227
233 skb = skb_prepare(d, f); 228 skb = skb_prepare(d, f);
234 if (skb) { 229 if (skb) {
@@ -308,16 +303,16 @@ ataid_complete(struct aoedev *d, unsigned char *id)
308 u16 n; 303 u16 n;
309 304
310 /* word 83: command set supported */ 305 /* word 83: command set supported */
311 n = __le16_to_cpu(*((u16 *) &id[83<<1])); 306 n = le16_to_cpup((__le16 *) &id[83<<1]);
312 307
313 /* word 86: command set/feature enabled */ 308 /* word 86: command set/feature enabled */
314 n |= __le16_to_cpu(*((u16 *) &id[86<<1])); 309 n |= le16_to_cpup((__le16 *) &id[86<<1]);
315 310
316 if (n & (1<<10)) { /* bit 10: LBA 48 */ 311 if (n & (1<<10)) { /* bit 10: LBA 48 */
317 d->flags |= DEVFL_EXT; 312 d->flags |= DEVFL_EXT;
318 313
319 /* word 100: number lba48 sectors */ 314 /* word 100: number lba48 sectors */
320 ssize = __le64_to_cpu(*((u64 *) &id[100<<1])); 315 ssize = le64_to_cpup((__le64 *) &id[100<<1]);
321 316
322 /* set as in ide-disk.c:init_idedisk_capacity */ 317 /* set as in ide-disk.c:init_idedisk_capacity */
323 d->geo.cylinders = ssize; 318 d->geo.cylinders = ssize;
@@ -328,12 +323,12 @@ ataid_complete(struct aoedev *d, unsigned char *id)
328 d->flags &= ~DEVFL_EXT; 323 d->flags &= ~DEVFL_EXT;
329 324
330 /* number lba28 sectors */ 325 /* number lba28 sectors */
331 ssize = __le32_to_cpu(*((u32 *) &id[60<<1])); 326 ssize = le32_to_cpup((__le32 *) &id[60<<1]);
332 327
333 /* NOTE: obsolete in ATA 6 */ 328 /* NOTE: obsolete in ATA 6 */
334 d->geo.cylinders = __le16_to_cpu(*((u16 *) &id[54<<1])); 329 d->geo.cylinders = le16_to_cpup((__le16 *) &id[54<<1]);
335 d->geo.heads = __le16_to_cpu(*((u16 *) &id[55<<1])); 330 d->geo.heads = le16_to_cpup((__le16 *) &id[55<<1]);
336 d->geo.sectors = __le16_to_cpu(*((u16 *) &id[56<<1])); 331 d->geo.sectors = le16_to_cpup((__le16 *) &id[56<<1]);
337 } 332 }
338 d->ssize = ssize; 333 d->ssize = ssize;
339 d->geo.start = 0; 334 d->geo.start = 0;
@@ -383,7 +378,7 @@ aoecmd_ata_rsp(struct sk_buff *skb)
383 u16 aoemajor; 378 u16 aoemajor;
384 379
385 hin = (struct aoe_hdr *) skb->mac.raw; 380 hin = (struct aoe_hdr *) skb->mac.raw;
386 aoemajor = __be16_to_cpu(*((u16 *) hin->major)); 381 aoemajor = be16_to_cpu(hin->major);
387 d = aoedev_by_aoeaddr(aoemajor, hin->minor); 382 d = aoedev_by_aoeaddr(aoemajor, hin->minor);
388 if (d == NULL) { 383 if (d == NULL) {
389 snprintf(ebuf, sizeof ebuf, "aoecmd_ata_rsp: ata response " 384 snprintf(ebuf, sizeof ebuf, "aoecmd_ata_rsp: ata response "
@@ -395,15 +390,15 @@ aoecmd_ata_rsp(struct sk_buff *skb)
395 390
396 spin_lock_irqsave(&d->lock, flags); 391 spin_lock_irqsave(&d->lock, flags);
397 392
398 f = getframe(d, __be32_to_cpu(*((u32 *) hin->tag))); 393 f = getframe(d, be32_to_cpu(hin->tag));
399 if (f == NULL) { 394 if (f == NULL) {
400 spin_unlock_irqrestore(&d->lock, flags); 395 spin_unlock_irqrestore(&d->lock, flags);
401 snprintf(ebuf, sizeof ebuf, 396 snprintf(ebuf, sizeof ebuf,
402 "%15s e%d.%d tag=%08x@%08lx\n", 397 "%15s e%d.%d tag=%08x@%08lx\n",
403 "unexpected rsp", 398 "unexpected rsp",
404 __be16_to_cpu(*((u16 *) hin->major)), 399 be16_to_cpu(hin->major),
405 hin->minor, 400 hin->minor,
406 __be32_to_cpu(*((u32 *) hin->tag)), 401 be32_to_cpu(hin->tag),
407 jiffies); 402 jiffies);
408 aoechr_error(ebuf); 403 aoechr_error(ebuf);
409 return; 404 return;
@@ -453,7 +448,7 @@ aoecmd_ata_rsp(struct sk_buff *skb)
453 printk(KERN_INFO "aoe: aoecmd_ata_rsp: unrecognized " 448 printk(KERN_INFO "aoe: aoecmd_ata_rsp: unrecognized "
454 "outbound ata command %2.2Xh for %d.%d\n", 449 "outbound ata command %2.2Xh for %d.%d\n",
455 ahout->cmdstat, 450 ahout->cmdstat,
456 __be16_to_cpu(*((u16 *) hin->major)), 451 be16_to_cpu(hin->major),
457 hin->minor); 452 hin->minor);
458 } 453 }
459 } 454 }
@@ -487,8 +482,6 @@ aoecmd_cfg(ushort aoemajor, unsigned char aoeminor)
487 struct aoe_cfghdr *ch; 482 struct aoe_cfghdr *ch;
488 struct sk_buff *skb, *sl; 483 struct sk_buff *skb, *sl;
489 struct net_device *ifp; 484 struct net_device *ifp;
490 u16 aoe_type = __constant_cpu_to_be16(ETH_P_AOE);
491 u16 net_aoemajor = __cpu_to_be16(aoemajor);
492 485
493 sl = NULL; 486 sl = NULL;
494 487
@@ -508,9 +501,9 @@ aoecmd_cfg(ushort aoemajor, unsigned char aoeminor)
508 501
509 memset(h->dst, 0xff, sizeof h->dst); 502 memset(h->dst, 0xff, sizeof h->dst);
510 memcpy(h->src, ifp->dev_addr, sizeof h->src); 503 memcpy(h->src, ifp->dev_addr, sizeof h->src);
511 memcpy(h->type, &aoe_type, sizeof aoe_type); 504 h->type = __constant_cpu_to_be16(ETH_P_AOE);
512 h->verfl = AOE_HVER; 505 h->verfl = AOE_HVER;
513 memcpy(h->major, &net_aoemajor, sizeof net_aoemajor); 506 h->major = cpu_to_be16(aoemajor);
514 h->minor = aoeminor; 507 h->minor = aoeminor;
515 h->cmd = AOECMD_CFG; 508 h->cmd = AOECMD_CFG;
516 509
@@ -576,7 +569,8 @@ aoecmd_cfg_rsp(struct sk_buff *skb)
576 struct aoedev *d; 569 struct aoedev *d;
577 struct aoe_hdr *h; 570 struct aoe_hdr *h;
578 struct aoe_cfghdr *ch; 571 struct aoe_cfghdr *ch;
579 ulong flags, bufcnt, sysminor, aoemajor; 572 ulong flags, sysminor, aoemajor;
573 u16 bufcnt;
580 struct sk_buff *sl; 574 struct sk_buff *sl;
581 enum { MAXFRAMES = 8 }; 575 enum { MAXFRAMES = 8 };
582 576
@@ -587,7 +581,7 @@ aoecmd_cfg_rsp(struct sk_buff *skb)
587 * Enough people have their dip switches set backwards to 581 * Enough people have their dip switches set backwards to
588 * warrant a loud message for this special case. 582 * warrant a loud message for this special case.
589 */ 583 */
590 aoemajor = __be16_to_cpu(*((u16 *) h->major)); 584 aoemajor = be16_to_cpu(h->major);
591 if (aoemajor == 0xfff) { 585 if (aoemajor == 0xfff) {
592 printk(KERN_CRIT "aoe: aoecmd_cfg_rsp: Warning: shelf " 586 printk(KERN_CRIT "aoe: aoecmd_cfg_rsp: Warning: shelf "
593 "address is all ones. Check shelf dip switches\n"); 587 "address is all ones. Check shelf dip switches\n");
@@ -602,7 +596,7 @@ aoecmd_cfg_rsp(struct sk_buff *skb)
602 return; 596 return;
603 } 597 }
604 598
605 bufcnt = __be16_to_cpu(*((u16 *) ch->bufcnt)); 599 bufcnt = be16_to_cpu(ch->bufcnt);
606 if (bufcnt > MAXFRAMES) /* keep it reasonable */ 600 if (bufcnt > MAXFRAMES) /* keep it reasonable */
607 bufcnt = MAXFRAMES; 601 bufcnt = MAXFRAMES;
608 602
@@ -619,7 +613,7 @@ aoecmd_cfg_rsp(struct sk_buff *skb)
619 return; 613 return;
620 } 614 }
621 615
622 d->fw_ver = __be16_to_cpu(*((u16 *) ch->fwver)); 616 d->fw_ver = be16_to_cpu(ch->fwver);
623 617
624 /* we get here only if the device is new */ 618 /* we get here only if the device is new */
625 sl = aoecmd_ata_id(d); 619 sl = aoecmd_ata_id(d);
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)
69u64 69u64
70mac_addr(char addr[6]) 70mac_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
108aoenet_rcv(struct sk_buff *skb, struct net_device *ifp, struct packet_type *pt) 108aoenet_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 }