]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
[AOE]: Introduce aoe_hdr()
authorArnaldo Carvalho de Melo <acme@redhat.com>
Sat, 10 Mar 2007 14:20:07 +0000 (11:20 -0300)
committerDavid S. Miller <davem@sunset.davemloft.net>
Thu, 26 Apr 2007 05:24:28 +0000 (22:24 -0700)
For consistency with other skb->mac.raw users.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/block/aoe/aoe.h
drivers/block/aoe/aoecmd.c
drivers/block/aoe/aoenet.c

index 2308e83e5f33aff25297a2ef7ad3363a56a645ef..4c34f8d31cc952f1833a2a276a10095fe52b42ea 100644 (file)
@@ -48,6 +48,15 @@ struct aoe_hdr {
        __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 {
        unsigned char aflags;
        unsigned char errfeat;
index 8d17d8df36621e479e3c2b7d4760ecc2baee2346..4ab7b40e8c5af5e4de493f114f3a98c84ba7c9e2 100644 (file)
@@ -118,7 +118,7 @@ aoecmd_ata_rw(struct aoedev *d, struct frame *f)
 
        /* initialize the headers & frame */
        skb = f->skb;
-       h = (struct aoe_hdr *) skb->mac.raw;
+       h = aoe_hdr(skb);
        ah = (struct aoe_atahdr *) (h+1);
        skb_put(skb, sizeof *h + sizeof *ah);
        memset(h, 0, skb->len);
@@ -207,7 +207,7 @@ aoecmd_cfg_pkts(ushort aoemajor, unsigned char aoeminor, struct sk_buff **tail)
                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);
@@ -300,7 +300,7 @@ rexmit(struct aoedev *d, struct frame *f)
        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);
@@ -529,7 +529,7 @@ aoecmd_ata_rsp(struct sk_buff *skb)
        char ebuf[128];
        u16 aoemajor;
 
-       hin = (struct aoe_hdr *) skb->mac.raw;
+       hin = aoe_hdr(skb);
        aoemajor = be16_to_cpu(get_unaligned(&hin->major));
        d = aoedev_by_aoeaddr(aoemajor, hin->minor);
        if (d == NULL) {
@@ -561,7 +561,7 @@ aoecmd_ata_rsp(struct sk_buff *skb)
        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;
 
@@ -695,7 +695,7 @@ aoecmd_ata_id(struct aoedev *d)
 
        /* initialize the headers & frame */
        skb = f->skb;
-       h = (struct aoe_hdr *) skb->mac.raw;
+       h = aoe_hdr(skb);
        ah = (struct aoe_atahdr *) (h+1);
        skb_put(skb, sizeof *h + sizeof *ah);
        memset(h, 0, skb->len);
@@ -726,7 +726,7 @@ aoecmd_cfg_rsp(struct sk_buff *skb)
        enum { MAXFRAMES = 16 };
        u16 n;
 
-       h = (struct aoe_hdr *) skb->mac.raw;
+       h = aoe_hdr(skb);
        ch = (struct aoe_cfghdr *) (h+1);
 
        /*
index aab6d91a2c2285b03c50a1249b49d333f70dfb20..f9ddfda4d9cb5945e3800e4a6865691e6069765f 100644 (file)
@@ -123,7 +123,7 @@ aoenet_rcv(struct sk_buff *skb, struct net_device *ifp, struct packet_type *pt,
                goto exit;
        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));
        if ((h->verfl & AOEFL_RSP) == 0 || (n & 1<<31))
                goto exit;