Commit 029720f1 authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo Committed by David S. Miller

[AOE]: Introduce aoe_hdr()

For consistency with other skb->mac.raw users.
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4839fcce
...@@ -48,6 +48,15 @@ struct aoe_hdr { ...@@ -48,6 +48,15 @@ struct aoe_hdr {
__be32 tag; __be32 tag;
}; };
#ifdef __KERNEL__
#include <linux/skbuff.h>
static inline struct aoe_hdr *aoe_hdr(const struct sk_buff *skb)
{
return (struct aoe_hdr *)skb->mac.raw;
}
#endif
struct aoe_atahdr { struct aoe_atahdr {
unsigned char aflags; unsigned char aflags;
unsigned char errfeat; unsigned char errfeat;
......
...@@ -118,7 +118,7 @@ aoecmd_ata_rw(struct aoedev *d, struct frame *f) ...@@ -118,7 +118,7 @@ aoecmd_ata_rw(struct aoedev *d, struct frame *f)
/* initialize the headers & frame */ /* initialize the headers & frame */
skb = f->skb; 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_put(skb, sizeof *h + sizeof *ah); skb_put(skb, sizeof *h + sizeof *ah);
memset(h, 0, skb->len); memset(h, 0, skb->len);
...@@ -207,7 +207,7 @@ aoecmd_cfg_pkts(ushort aoemajor, unsigned char aoeminor, struct sk_buff **tail) ...@@ -207,7 +207,7 @@ aoecmd_cfg_pkts(ushort aoemajor, unsigned char aoeminor, struct sk_buff **tail)
skb->dev = ifp; skb->dev = ifp;
if (sl_tail == NULL) if (sl_tail == NULL)
sl_tail = skb; sl_tail = skb;
h = (struct aoe_hdr *) skb->mac.raw; h = aoe_hdr(skb);
memset(h, 0, sizeof *h + sizeof *ch); memset(h, 0, sizeof *h + sizeof *ch);
memset(h->dst, 0xff, sizeof h->dst); memset(h->dst, 0xff, sizeof h->dst);
...@@ -300,7 +300,7 @@ rexmit(struct aoedev *d, struct frame *f) ...@@ -300,7 +300,7 @@ rexmit(struct aoedev *d, struct frame *f)
aoechr_error(buf); aoechr_error(buf);
skb = f->skb; 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);
f->tag = n; f->tag = n;
h->tag = cpu_to_be32(n); h->tag = cpu_to_be32(n);
...@@ -529,7 +529,7 @@ aoecmd_ata_rsp(struct sk_buff *skb) ...@@ -529,7 +529,7 @@ aoecmd_ata_rsp(struct sk_buff *skb)
char ebuf[128]; char ebuf[128];
u16 aoemajor; u16 aoemajor;
hin = (struct aoe_hdr *) skb->mac.raw; hin = aoe_hdr(skb);
aoemajor = be16_to_cpu(get_unaligned(&hin->major)); aoemajor = be16_to_cpu(get_unaligned(&hin->major));
d = aoedev_by_aoeaddr(aoemajor, hin->minor); d = aoedev_by_aoeaddr(aoemajor, hin->minor);
if (d == NULL) { if (d == NULL) {
...@@ -561,7 +561,7 @@ aoecmd_ata_rsp(struct sk_buff *skb) ...@@ -561,7 +561,7 @@ aoecmd_ata_rsp(struct sk_buff *skb)
calc_rttavg(d, tsince(f->tag)); calc_rttavg(d, tsince(f->tag));
ahin = (struct aoe_atahdr *) (hin+1); 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); ahout = (struct aoe_atahdr *) (hout+1);
buf = f->buf; buf = f->buf;
...@@ -695,7 +695,7 @@ aoecmd_ata_id(struct aoedev *d) ...@@ -695,7 +695,7 @@ aoecmd_ata_id(struct aoedev *d)
/* initialize the headers & frame */ /* initialize the headers & frame */
skb = f->skb; 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_put(skb, sizeof *h + sizeof *ah); skb_put(skb, sizeof *h + sizeof *ah);
memset(h, 0, skb->len); memset(h, 0, skb->len);
...@@ -726,7 +726,7 @@ aoecmd_cfg_rsp(struct sk_buff *skb) ...@@ -726,7 +726,7 @@ aoecmd_cfg_rsp(struct sk_buff *skb)
enum { MAXFRAMES = 16 }; enum { MAXFRAMES = 16 };
u16 n; u16 n;
h = (struct aoe_hdr *) skb->mac.raw; h = aoe_hdr(skb);
ch = (struct aoe_cfghdr *) (h+1); ch = (struct aoe_cfghdr *) (h+1);
/* /*
......
...@@ -123,7 +123,7 @@ aoenet_rcv(struct sk_buff *skb, struct net_device *ifp, struct packet_type *pt, ...@@ -123,7 +123,7 @@ aoenet_rcv(struct sk_buff *skb, struct net_device *ifp, struct packet_type *pt,
goto exit; goto exit;
skb_push(skb, ETH_HLEN); /* (1) */ skb_push(skb, ETH_HLEN); /* (1) */
h = (struct aoe_hdr *) skb->mac.raw; h = aoe_hdr(skb);
n = be32_to_cpu(get_unaligned(&h->tag)); n = be32_to_cpu(get_unaligned(&h->tag));
if ((h->verfl & AOEFL_RSP) == 0 || (n & 1<<31)) if ((h->verfl & AOEFL_RSP) == 0 || (n & 1<<31))
goto exit; goto exit;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment