Staging: batman-adv: Unify sysfs file names with their bat_priv atomics
[firefly-linux-kernel-4.4.55.git] / drivers / staging / batman-adv / unicast.c
index 12afae618ce232cf7be8b8ea1375260ca5722e53..5ae959327b489dd597143b9985f14728b3ed061d 100644 (file)
@@ -36,6 +36,9 @@ static struct sk_buff *frag_merge_packet(struct list_head *head,
        struct unicast_frag_packet *up =
                (struct unicast_frag_packet *)skb->data;
        struct sk_buff *tmp_skb;
+       struct unicast_packet *unicast_packet;
+       int hdr_len = sizeof(struct unicast_packet),
+           uni_diff = sizeof(struct unicast_frag_packet) - hdr_len;
 
        /* set skb to the first part and tmp_skb to the second part */
        if (up->flags & UNI_FRAG_HEAD) {
@@ -59,6 +62,11 @@ static struct sk_buff *frag_merge_packet(struct list_head *head,
 
        memcpy(skb_put(skb, tmp_skb->len), tmp_skb->data, tmp_skb->len);
        kfree_skb(tmp_skb);
+
+       memmove(skb->data + uni_diff, skb->data, hdr_len);
+       unicast_packet = (struct unicast_packet *) skb_pull(skb, uni_diff);
+       unicast_packet->packet_type = BAT_UNICAST;
+
        return skb;
 }
 
@@ -310,7 +318,7 @@ int unicast_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv)
        /* copy the destination for faster routing */
        memcpy(unicast_packet->dest, orig_node->orig, ETH_ALEN);
 
-       if (atomic_read(&bat_priv->frag_enabled) &&
+       if (atomic_read(&bat_priv->fragmentation) &&
            data_len + sizeof(struct unicast_packet) >
            batman_if->net_dev->mtu) {
                /* send frag skb decreases ttl */