projects
/
powerpc.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[SK_BUFF]: Introduce skb_reset_mac_header(skb)
[powerpc.git]
/
drivers
/
block
/
aoe
/
aoecmd.c
diff --git
a/drivers/block/aoe/aoecmd.c
b/drivers/block/aoe/aoecmd.c
index
97f7f53
..
74062dc
100644
(file)
--- a/
drivers/block/aoe/aoecmd.c
+++ b/
drivers/block/aoe/aoecmd.c
@@
-27,11
+27,10
@@
new_skb(ulong len)
skb = alloc_skb(len, GFP_ATOMIC);
if (skb) {
skb = alloc_skb(len, GFP_ATOMIC);
if (skb) {
- skb->nh.raw = skb->mac.raw = skb->data;
+ skb_reset_mac_header(skb);
+ skb->nh.raw = skb->data;
skb->protocol = __constant_htons(ETH_P_AOE);
skb->priority = 0;
skb->protocol = __constant_htons(ETH_P_AOE);
skb->priority = 0;
- skb_put(skb, len);
- memset(skb->head, 0, len);
skb->next = skb->prev = NULL;
/* tell the network layer not to perform IP checksums
skb->next = skb->prev = NULL;
/* tell the network layer not to perform IP checksums
@@
-120,10
+119,10
@@
aoecmd_ata_rw(struct aoedev *d, struct frame *f)
/* initialize the headers & frame */
skb = f->skb;
/* initialize the headers & frame */
skb = f->skb;
- h =
(struct aoe_hdr *) skb->mac.raw
;
+ h =
aoe_hdr(skb)
;
ah = (struct aoe_atahdr *) (h+1);
ah = (struct aoe_atahdr *) (h+1);
- skb
->len = sizeof *h + sizeof *ah
;
- memset(h, 0,
ETH_ZLEN
);
+ skb
_put(skb, sizeof *h + sizeof *ah)
;
+ memset(h, 0,
skb->len
);
f->tag = aoehdr_atainit(d, h);
f->waited = 0;
f->buf = buf;
f->tag = aoehdr_atainit(d, h);
f->waited = 0;
f->buf = buf;
@@
-149,7
+148,6
@@
aoecmd_ata_rw(struct aoedev *d, struct frame *f)
skb->len += bcnt;
skb->data_len = bcnt;
} else {
skb->len += bcnt;
skb->data_len = bcnt;
} else {
- skb->len = ETH_ZLEN;
writebit = 0;
}
writebit = 0;
}
@@
-206,10
+204,11
@@
aoecmd_cfg_pkts(ushort aoemajor, unsigned char aoeminor, struct sk_buff **tail)
printk(KERN_INFO "aoe: skb alloc failure\n");
continue;
}
printk(KERN_INFO "aoe: skb alloc failure\n");
continue;
}
+ skb_put(skb, sizeof *h + sizeof *ch);
skb->dev = ifp;
if (sl_tail == NULL)
sl_tail = skb;
skb->dev = ifp;
if (sl_tail == NULL)
sl_tail = skb;
- h =
(struct aoe_hdr *) skb->mac.raw
;
+ h =
aoe_hdr(skb)
;
memset(h, 0, sizeof *h + sizeof *ch);
memset(h->dst, 0xff, sizeof h->dst);
memset(h, 0, sizeof *h + sizeof *ch);
memset(h->dst, 0xff, sizeof h->dst);
@@
-243,6
+242,7
@@
freeframe(struct aoedev *d)
continue;
if (atomic_read(&skb_shinfo(f->skb)->dataref) == 1) {
skb_shinfo(f->skb)->nr_frags = f->skb->data_len = 0;
continue;
if (atomic_read(&skb_shinfo(f->skb)->dataref) == 1) {
skb_shinfo(f->skb)->nr_frags = f->skb->data_len = 0;
+ skb_trim(f->skb, 0);
return f;
}
n++;
return f;
}
n++;
@@
-301,7
+301,7
@@
rexmit(struct aoedev *d, struct frame *f)
aoechr_error(buf);
skb = f->skb;
aoechr_error(buf);
skb = f->skb;
- h =
(struct aoe_hdr *) skb->mac.raw
;
+ h =
aoe_hdr(skb)
;
ah = (struct aoe_atahdr *) (h+1);
f->tag = n;
h->tag = cpu_to_be32(n);
ah = (struct aoe_atahdr *) (h+1);
f->tag = n;
h->tag = cpu_to_be32(n);
@@
-530,8
+530,8
@@
aoecmd_ata_rsp(struct sk_buff *skb)
char ebuf[128];
u16 aoemajor;
char ebuf[128];
u16 aoemajor;
- hin =
(struct aoe_hdr *) skb->mac.raw
;
- aoemajor = be16_to_cpu(
hin->major
);
+ hin =
aoe_hdr(skb)
;
+ aoemajor = be16_to_cpu(
get_unaligned(&hin->major)
);
d = aoedev_by_aoeaddr(aoemajor, hin->minor);
if (d == NULL) {
snprintf(ebuf, sizeof ebuf, "aoecmd_ata_rsp: ata response "
d = aoedev_by_aoeaddr(aoemajor, hin->minor);
if (d == NULL) {
snprintf(ebuf, sizeof ebuf, "aoecmd_ata_rsp: ata response "
@@
-543,7
+543,7
@@
aoecmd_ata_rsp(struct sk_buff *skb)
spin_lock_irqsave(&d->lock, flags);
spin_lock_irqsave(&d->lock, flags);
- n = be32_to_cpu(
hin->tag
);
+ n = be32_to_cpu(
get_unaligned(&hin->tag)
);
f = getframe(d, n);
if (f == NULL) {
calc_rttavg(d, -tsince(n));
f = getframe(d, n);
if (f == NULL) {
calc_rttavg(d, -tsince(n));
@@
-551,9
+551,9
@@
aoecmd_ata_rsp(struct sk_buff *skb)
snprintf(ebuf, sizeof ebuf,
"%15s e%d.%d tag=%08x@%08lx\n",
"unexpected rsp",
snprintf(ebuf, sizeof ebuf,
"%15s e%d.%d tag=%08x@%08lx\n",
"unexpected rsp",
- be16_to_cpu(
hin->major
),
+ be16_to_cpu(
get_unaligned(&hin->major)
),
hin->minor,
hin->minor,
- be32_to_cpu(
hin->tag
),
+ be32_to_cpu(
get_unaligned(&hin->tag)
),
jiffies);
aoechr_error(ebuf);
return;
jiffies);
aoechr_error(ebuf);
return;
@@
-562,7
+562,7
@@
aoecmd_ata_rsp(struct sk_buff *skb)
calc_rttavg(d, tsince(f->tag));
ahin = (struct aoe_atahdr *) (hin+1);
calc_rttavg(d, tsince(f->tag));
ahin = (struct aoe_atahdr *) (hin+1);
- hout =
(struct aoe_hdr *) f->skb->mac.raw
;
+ hout =
aoe_hdr(f->skb)
;
ahout = (struct aoe_atahdr *) (hout+1);
buf = f->buf;
ahout = (struct aoe_atahdr *) (hout+1);
buf = f->buf;
@@
-632,7
+632,7
@@
aoecmd_ata_rsp(struct sk_buff *skb)
printk(KERN_INFO
"aoe: unrecognized ata command %2.2Xh for %d.%d\n",
ahout->cmdstat,
printk(KERN_INFO
"aoe: unrecognized ata command %2.2Xh for %d.%d\n",
ahout->cmdstat,
- be16_to_cpu(
hin->major
),
+ be16_to_cpu(
get_unaligned(&hin->major)
),
hin->minor);
}
}
hin->minor);
}
}
@@
-696,10
+696,10
@@
aoecmd_ata_id(struct aoedev *d)
/* initialize the headers & frame */
skb = f->skb;
/* initialize the headers & frame */
skb = f->skb;
- h =
(struct aoe_hdr *) skb->mac.raw
;
+ h =
aoe_hdr(skb)
;
ah = (struct aoe_atahdr *) (h+1);
ah = (struct aoe_atahdr *) (h+1);
- skb
->len = ETH_ZLEN
;
- memset(h, 0,
ETH_ZLEN
);
+ skb
_put(skb, sizeof *h + sizeof *ah)
;
+ memset(h, 0,
skb->len
);
f->tag = aoehdr_atainit(d, h);
f->waited = 0;
f->tag = aoehdr_atainit(d, h);
f->waited = 0;
@@
-727,14
+727,14
@@
aoecmd_cfg_rsp(struct sk_buff *skb)
enum { MAXFRAMES = 16 };
u16 n;
enum { MAXFRAMES = 16 };
u16 n;
- h =
(struct aoe_hdr *) skb->mac.raw
;
+ h =
aoe_hdr(skb)
;
ch = (struct aoe_cfghdr *) (h+1);
/*
* Enough people have their dip switches set backwards to
* warrant a loud message for this special case.
*/
ch = (struct aoe_cfghdr *) (h+1);
/*
* Enough people have their dip switches set backwards to
* warrant a loud message for this special case.
*/
- aoemajor = be16_to_cpu(
h->major
);
+ aoemajor = be16_to_cpu(
get_unaligned(&h->major)
);
if (aoemajor == 0xfff) {
printk(KERN_ERR "aoe: Warning: shelf address is all ones. "
"Check shelf dip switches.\n");
if (aoemajor == 0xfff) {
printk(KERN_ERR "aoe: Warning: shelf address is all ones. "
"Check shelf dip switches.\n");