]> git.karo-electronics.de Git - linux-beck.git/commitdiff
batman-adv: Include frame priority in fragment header
authorAndrew Lunn <andrew@lunn.ch>
Mon, 9 May 2016 18:03:36 +0000 (20:03 +0200)
committerSimon Wunderlich <sw@simonwunderlich.de>
Thu, 30 Jun 2016 08:29:43 +0000 (10:29 +0200)
Unfragmented frames which traverse a node have their skb->priority set
by looking at the IP ToS byte, or the 802.1p header. However for
fragments this is not possible, only one of the fragments will contain
the headers. Instead, place the priority into the fragment header and
on receiving a fragment, use this information to set the skb->priority
for when the fragment is forwarded.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
net/batman-adv/fragmentation.c
net/batman-adv/packet.h
net/batman-adv/routing.c

index a119b6a6365f541fd2ae0b8a0c704858ef8896f1..9f41a0a0d6ab4343dce64e07b1df26d56a96cd58 100644 (file)
@@ -472,6 +472,15 @@ bool batadv_frag_send_packet(struct sk_buff *skb,
        frag_header.reserved = 0;
        frag_header.no = 0;
        frag_header.total_size = htons(skb->len);
+
+       /* skb->priority values from 256->263 are magic values to
+        * directly indicate a specific 802.1d priority.  This is used
+        * to allow 802.1d priority to be passed directly in from VLAN
+        * tags, etc.
+        */
+       if (skb->priority >= 256 && skb->priority <= 263)
+               frag_header.priority = skb->priority - 256;
+
        ether_addr_copy(frag_header.orig, primary_if->net_dev->dev_addr);
        ether_addr_copy(frag_header.dest, orig_node->orig);
 
index 372128ddb474de09b8e60538f499a8bf5d463c9c..71567794df1776f85dae6fd424b0e79dea56eca2 100644 (file)
@@ -420,6 +420,7 @@ struct batadv_unicast_4addr_packet {
  * @dest: final destination used when routing fragments
  * @orig: originator of the fragment used when merging the packet
  * @no: fragment number within this sequence
+ * @priority: priority of frame, from ToS IP precedence or 802.1p
  * @reserved: reserved byte for alignment
  * @seqno: sequence identification
  * @total_size: size of the merged packet
@@ -430,9 +431,11 @@ struct batadv_frag_packet {
        u8     ttl;
 #if defined(__BIG_ENDIAN_BITFIELD)
        u8     no:4;
-       u8     reserved:4;
+       u8     priority:3;
+       u8     reserved:1;
 #elif defined(__LITTLE_ENDIAN_BITFIELD)
-       u8     reserved:4;
+       u8     reserved:1;
+       u8     priority:3;
        u8     no:4;
 #else
 #error "unknown bitfield endianness"
index f75091c983eed8dfb84dde71b25302211e69ff91..24fc75335b3180b690000ff29a2d3dc4de15ae94 100644 (file)
@@ -1006,6 +1006,8 @@ int batadv_recv_frag_packet(struct sk_buff *skb,
        if (!orig_node_src)
                goto out;
 
+       skb->priority = frag_packet->priority + 256;
+
        /* Route the fragment if it is not for us and too big to be merged. */
        if (!batadv_is_my_mac(bat_priv, frag_packet->dest) &&
            batadv_frag_skb_fwd(skb, recv_if, orig_node_src)) {