Merge branch 'for-linus' of master.kernel.org:/pub/scm/linux/kernel/git/dtor/input
[pandora-kernel.git] / drivers / block / aoe / aoecmd.c
index 97f7f53..8d17d8d 100644 (file)
@@ -30,8 +30,6 @@ new_skb(ulong len)
                skb->nh.raw = skb->mac.raw = skb->data;
                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
@@ -122,8 +120,8 @@ aoecmd_ata_rw(struct aoedev *d, struct frame *f)
        skb = f->skb;
        h = (struct aoe_hdr *) skb->mac.raw;
        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;
@@ -149,7 +147,6 @@ aoecmd_ata_rw(struct aoedev *d, struct frame *f)
                skb->len += bcnt;
                skb->data_len = bcnt;
        } else {
-               skb->len = ETH_ZLEN;
                writebit = 0;
        }
 
@@ -206,6 +203,7 @@ aoecmd_cfg_pkts(ushort aoemajor, unsigned char aoeminor, struct sk_buff **tail)
                        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;
@@ -243,6 +241,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;
+                       skb_trim(f->skb, 0);
                        return f;
                }
                n++;
@@ -531,7 +530,7 @@ aoecmd_ata_rsp(struct sk_buff *skb)
        u16 aoemajor;
 
        hin = (struct aoe_hdr *) skb->mac.raw;
-       aoemajor = be16_to_cpu(hin->major);
+       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 "
@@ -543,7 +542,7 @@ aoecmd_ata_rsp(struct sk_buff *skb)
 
        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));
@@ -551,9 +550,9 @@ aoecmd_ata_rsp(struct sk_buff *skb)
                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,
-                       be32_to_cpu(hin->tag),
+                       be32_to_cpu(get_unaligned(&hin->tag)),
                        jiffies);
                aoechr_error(ebuf);
                return;
@@ -632,7 +631,7 @@ aoecmd_ata_rsp(struct sk_buff *skb)
                        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);
                }
        }
@@ -698,8 +697,8 @@ aoecmd_ata_id(struct aoedev *d)
        skb = f->skb;
        h = (struct aoe_hdr *) skb->mac.raw;
        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;
 
@@ -734,7 +733,7 @@ aoecmd_cfg_rsp(struct sk_buff *skb)
         * 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");