aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/block/aoe/aoe.h9
-rw-r--r--drivers/block/aoe/aoecmd.c14
-rw-r--r--drivers/block/aoe/aoenet.c2
3 files changed, 17 insertions, 8 deletions
diff --git a/drivers/block/aoe/aoe.h b/drivers/block/aoe/aoe.h
index 2308e83e5f33..4c34f8d31cc9 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
54static inline struct aoe_hdr *aoe_hdr(const struct sk_buff *skb)
55{
56 return (struct aoe_hdr *)skb->mac.raw;
57}
58#endif
59
51struct aoe_atahdr { 60struct 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..4ab7b40e8c5a 100644
--- a/drivers/block/aoe/aoecmd.c
+++ b/drivers/block/aoe/aoecmd.c
@@ -118,7 +118,7 @@ aoecmd_ata_rw(struct aoedev *d, struct frame *f)
118 118
119 /* initialize the headers & frame */ 119 /* initialize the headers & frame */
120 skb = f->skb; 120 skb = f->skb;
121 h = (struct aoe_hdr *) skb->mac.raw; 121 h = aoe_hdr(skb);
122 ah = (struct aoe_atahdr *) (h+1); 122 ah = (struct aoe_atahdr *) (h+1);
123 skb_put(skb, sizeof *h + sizeof *ah); 123 skb_put(skb, sizeof *h + sizeof *ah);
124 memset(h, 0, skb->len); 124 memset(h, 0, skb->len);
@@ -207,7 +207,7 @@ aoecmd_cfg_pkts(ushort aoemajor, unsigned char aoeminor, struct sk_buff **tail)
207 skb->dev = ifp; 207 skb->dev = ifp;
208 if (sl_tail == NULL) 208 if (sl_tail == NULL)
209 sl_tail = skb; 209 sl_tail = skb;
210 h = (struct aoe_hdr *) skb->mac.raw; 210 h = aoe_hdr(skb);
211 memset(h, 0, sizeof *h + sizeof *ch); 211 memset(h, 0, sizeof *h + sizeof *ch);
212 212
213 memset(h->dst, 0xff, sizeof h->dst); 213 memset(h->dst, 0xff, sizeof h->dst);
@@ -300,7 +300,7 @@ rexmit(struct aoedev *d, struct frame *f)
300 aoechr_error(buf); 300 aoechr_error(buf);
301 301
302 skb = f->skb; 302 skb = f->skb;
303 h = (struct aoe_hdr *) skb->mac.raw; 303 h = aoe_hdr(skb);
304 ah = (struct aoe_atahdr *) (h+1); 304 ah = (struct aoe_atahdr *) (h+1);
305 f->tag = n; 305 f->tag = n;
306 h->tag = cpu_to_be32(n); 306 h->tag = cpu_to_be32(n);
@@ -529,7 +529,7 @@ aoecmd_ata_rsp(struct sk_buff *skb)
529 char ebuf[128]; 529 char ebuf[128];
530 u16 aoemajor; 530 u16 aoemajor;
531 531
532 hin = (struct aoe_hdr *) skb->mac.raw; 532 hin = aoe_hdr(skb);
533 aoemajor = be16_to_cpu(get_unaligned(&hin->major)); 533 aoemajor = be16_to_cpu(get_unaligned(&hin->major));
534 d = aoedev_by_aoeaddr(aoemajor, hin->minor); 534 d = aoedev_by_aoeaddr(aoemajor, hin->minor);
535 if (d == NULL) { 535 if (d == NULL) {
@@ -561,7 +561,7 @@ aoecmd_ata_rsp(struct sk_buff *skb)
561 calc_rttavg(d, tsince(f->tag)); 561 calc_rttavg(d, tsince(f->tag));
562 562
563 ahin = (struct aoe_atahdr *) (hin+1); 563 ahin = (struct aoe_atahdr *) (hin+1);
564 hout = (struct aoe_hdr *) f->skb->mac.raw; 564 hout = aoe_hdr(f->skb);
565 ahout = (struct aoe_atahdr *) (hout+1); 565 ahout = (struct aoe_atahdr *) (hout+1);
566 buf = f->buf; 566 buf = f->buf;
567 567
@@ -695,7 +695,7 @@ aoecmd_ata_id(struct aoedev *d)
695 695
696 /* initialize the headers & frame */ 696 /* initialize the headers & frame */
697 skb = f->skb; 697 skb = f->skb;
698 h = (struct aoe_hdr *) skb->mac.raw; 698 h = aoe_hdr(skb);
699 ah = (struct aoe_atahdr *) (h+1); 699 ah = (struct aoe_atahdr *) (h+1);
700 skb_put(skb, sizeof *h + sizeof *ah); 700 skb_put(skb, sizeof *h + sizeof *ah);
701 memset(h, 0, skb->len); 701 memset(h, 0, skb->len);
@@ -726,7 +726,7 @@ aoecmd_cfg_rsp(struct sk_buff *skb)
726 enum { MAXFRAMES = 16 }; 726 enum { MAXFRAMES = 16 };
727 u16 n; 727 u16 n;
728 728
729 h = (struct aoe_hdr *) skb->mac.raw; 729 h = aoe_hdr(skb);
730 ch = (struct aoe_cfghdr *) (h+1); 730 ch = (struct aoe_cfghdr *) (h+1);
731 731
732 /* 732 /*
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;