diff options
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/aoe/aoe.h | 9 | ||||
-rw-r--r-- | drivers/block/aoe/aoecmd.c | 17 | ||||
-rw-r--r-- | drivers/block/aoe/aoenet.c | 2 |
3 files changed, 19 insertions, 9 deletions
diff --git a/drivers/block/aoe/aoe.h b/drivers/block/aoe/aoe.h index 2308e83e5f33..1d8466817943 100644 --- a/drivers/block/aoe/aoe.h +++ b/drivers/block/aoe/aoe.h | |||
@@ -48,6 +48,15 @@ struct aoe_hdr { | |||
48 | __be32 tag; | 48 | __be32 tag; |
49 | }; | 49 | }; |
50 | 50 | ||
51 | #ifdef __KERNEL__ | ||
52 | #include <linux/skbuff.h> | ||
53 | |||
54 | static inline struct aoe_hdr *aoe_hdr(const struct sk_buff *skb) | ||
55 | { | ||
56 | return (struct aoe_hdr *)skb_mac_header(skb); | ||
57 | } | ||
58 | #endif | ||
59 | |||
51 | struct aoe_atahdr { | 60 | struct aoe_atahdr { |
52 | unsigned char aflags; | 61 | unsigned char aflags; |
53 | unsigned char errfeat; | 62 | unsigned char errfeat; |
diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c index 8d17d8df3662..1a6aeac5a1c3 100644 --- a/drivers/block/aoe/aoecmd.c +++ b/drivers/block/aoe/aoecmd.c | |||
@@ -27,7 +27,8 @@ new_skb(ulong len) | |||
27 | 27 | ||
28 | skb = alloc_skb(len, GFP_ATOMIC); | 28 | skb = alloc_skb(len, GFP_ATOMIC); |
29 | if (skb) { | 29 | if (skb) { |
30 | skb->nh.raw = skb->mac.raw = skb->data; | 30 | skb_reset_mac_header(skb); |
31 | skb_reset_network_header(skb); | ||
31 | skb->protocol = __constant_htons(ETH_P_AOE); | 32 | skb->protocol = __constant_htons(ETH_P_AOE); |
32 | skb->priority = 0; | 33 | skb->priority = 0; |
33 | skb->next = skb->prev = NULL; | 34 | skb->next = skb->prev = NULL; |
@@ -118,7 +119,7 @@ aoecmd_ata_rw(struct aoedev *d, struct frame *f) | |||
118 | 119 | ||
119 | /* initialize the headers & frame */ | 120 | /* initialize the headers & frame */ |
120 | skb = f->skb; | 121 | skb = f->skb; |
121 | h = (struct aoe_hdr *) skb->mac.raw; | 122 | h = aoe_hdr(skb); |
122 | ah = (struct aoe_atahdr *) (h+1); | 123 | ah = (struct aoe_atahdr *) (h+1); |
123 | skb_put(skb, sizeof *h + sizeof *ah); | 124 | skb_put(skb, sizeof *h + sizeof *ah); |
124 | memset(h, 0, skb->len); | 125 | memset(h, 0, skb->len); |
@@ -207,7 +208,7 @@ aoecmd_cfg_pkts(ushort aoemajor, unsigned char aoeminor, struct sk_buff **tail) | |||
207 | skb->dev = ifp; | 208 | skb->dev = ifp; |
208 | if (sl_tail == NULL) | 209 | if (sl_tail == NULL) |
209 | sl_tail = skb; | 210 | sl_tail = skb; |
210 | h = (struct aoe_hdr *) skb->mac.raw; | 211 | h = aoe_hdr(skb); |
211 | memset(h, 0, sizeof *h + sizeof *ch); | 212 | memset(h, 0, sizeof *h + sizeof *ch); |
212 | 213 | ||
213 | memset(h->dst, 0xff, sizeof h->dst); | 214 | memset(h->dst, 0xff, sizeof h->dst); |
@@ -300,7 +301,7 @@ rexmit(struct aoedev *d, struct frame *f) | |||
300 | aoechr_error(buf); | 301 | aoechr_error(buf); |
301 | 302 | ||
302 | skb = f->skb; | 303 | skb = f->skb; |
303 | h = (struct aoe_hdr *) skb->mac.raw; | 304 | h = aoe_hdr(skb); |
304 | ah = (struct aoe_atahdr *) (h+1); | 305 | ah = (struct aoe_atahdr *) (h+1); |
305 | f->tag = n; | 306 | f->tag = n; |
306 | h->tag = cpu_to_be32(n); | 307 | h->tag = cpu_to_be32(n); |
@@ -529,7 +530,7 @@ aoecmd_ata_rsp(struct sk_buff *skb) | |||
529 | char ebuf[128]; | 530 | char ebuf[128]; |
530 | u16 aoemajor; | 531 | u16 aoemajor; |
531 | 532 | ||
532 | hin = (struct aoe_hdr *) skb->mac.raw; | 533 | hin = aoe_hdr(skb); |
533 | aoemajor = be16_to_cpu(get_unaligned(&hin->major)); | 534 | aoemajor = be16_to_cpu(get_unaligned(&hin->major)); |
534 | d = aoedev_by_aoeaddr(aoemajor, hin->minor); | 535 | d = aoedev_by_aoeaddr(aoemajor, hin->minor); |
535 | if (d == NULL) { | 536 | if (d == NULL) { |
@@ -561,7 +562,7 @@ aoecmd_ata_rsp(struct sk_buff *skb) | |||
561 | calc_rttavg(d, tsince(f->tag)); | 562 | calc_rttavg(d, tsince(f->tag)); |
562 | 563 | ||
563 | ahin = (struct aoe_atahdr *) (hin+1); | 564 | ahin = (struct aoe_atahdr *) (hin+1); |
564 | hout = (struct aoe_hdr *) f->skb->mac.raw; | 565 | hout = aoe_hdr(f->skb); |
565 | ahout = (struct aoe_atahdr *) (hout+1); | 566 | ahout = (struct aoe_atahdr *) (hout+1); |
566 | buf = f->buf; | 567 | buf = f->buf; |
567 | 568 | ||
@@ -695,7 +696,7 @@ aoecmd_ata_id(struct aoedev *d) | |||
695 | 696 | ||
696 | /* initialize the headers & frame */ | 697 | /* initialize the headers & frame */ |
697 | skb = f->skb; | 698 | skb = f->skb; |
698 | h = (struct aoe_hdr *) skb->mac.raw; | 699 | h = aoe_hdr(skb); |
699 | ah = (struct aoe_atahdr *) (h+1); | 700 | ah = (struct aoe_atahdr *) (h+1); |
700 | skb_put(skb, sizeof *h + sizeof *ah); | 701 | skb_put(skb, sizeof *h + sizeof *ah); |
701 | memset(h, 0, skb->len); | 702 | memset(h, 0, skb->len); |
@@ -726,7 +727,7 @@ aoecmd_cfg_rsp(struct sk_buff *skb) | |||
726 | enum { MAXFRAMES = 16 }; | 727 | enum { MAXFRAMES = 16 }; |
727 | u16 n; | 728 | u16 n; |
728 | 729 | ||
729 | h = (struct aoe_hdr *) skb->mac.raw; | 730 | h = aoe_hdr(skb); |
730 | ch = (struct aoe_cfghdr *) (h+1); | 731 | ch = (struct aoe_cfghdr *) (h+1); |
731 | 732 | ||
732 | /* | 733 | /* |
diff --git a/drivers/block/aoe/aoenet.c b/drivers/block/aoe/aoenet.c index aab6d91a2c22..f9ddfda4d9cb 100644 --- a/drivers/block/aoe/aoenet.c +++ b/drivers/block/aoe/aoenet.c | |||
@@ -123,7 +123,7 @@ aoenet_rcv(struct sk_buff *skb, struct net_device *ifp, struct packet_type *pt, | |||
123 | goto exit; | 123 | goto exit; |
124 | skb_push(skb, ETH_HLEN); /* (1) */ | 124 | skb_push(skb, ETH_HLEN); /* (1) */ |
125 | 125 | ||
126 | h = (struct aoe_hdr *) skb->mac.raw; | 126 | h = aoe_hdr(skb); |
127 | n = be32_to_cpu(get_unaligned(&h->tag)); | 127 | n = be32_to_cpu(get_unaligned(&h->tag)); |
128 | if ((h->verfl & AOEFL_RSP) == 0 || (n & 1<<31)) | 128 | if ((h->verfl & AOEFL_RSP) == 0 || (n & 1<<31)) |
129 | goto exit; | 129 | goto exit; |