summaryrefslogtreecommitdiffstats
path: root/net/batman-adv
diff options
context:
space:
mode:
authorAndrew Lunn <andrew@lunn.ch>2016-05-09 14:03:36 -0400
committerSimon Wunderlich <sw@simonwunderlich.de>2016-06-30 04:29:43 -0400
commitc0f25c802b3300b28d1e67c58c702d29555838de (patch)
treef27c5176ee6786757fb43e522ed45d230bbfce60 /net/batman-adv
parent1914848e0d641f8d6173bb53b6a4a392468ac725 (diff)
batman-adv: Include frame priority in fragment header
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>
Diffstat (limited to 'net/batman-adv')
-rw-r--r--net/batman-adv/fragmentation.c9
-rw-r--r--net/batman-adv/packet.h7
-rw-r--r--net/batman-adv/routing.c2
3 files changed, 16 insertions, 2 deletions
diff --git a/net/batman-adv/fragmentation.c b/net/batman-adv/fragmentation.c
index a119b6a6365f..9f41a0a0d6ab 100644
--- a/net/batman-adv/fragmentation.c
+++ b/net/batman-adv/fragmentation.c
@@ -472,6 +472,15 @@ bool batadv_frag_send_packet(struct sk_buff *skb,
472 frag_header.reserved = 0; 472 frag_header.reserved = 0;
473 frag_header.no = 0; 473 frag_header.no = 0;
474 frag_header.total_size = htons(skb->len); 474 frag_header.total_size = htons(skb->len);
475
476 /* skb->priority values from 256->263 are magic values to
477 * directly indicate a specific 802.1d priority. This is used
478 * to allow 802.1d priority to be passed directly in from VLAN
479 * tags, etc.
480 */
481 if (skb->priority >= 256 && skb->priority <= 263)
482 frag_header.priority = skb->priority - 256;
483
475 ether_addr_copy(frag_header.orig, primary_if->net_dev->dev_addr); 484 ether_addr_copy(frag_header.orig, primary_if->net_dev->dev_addr);
476 ether_addr_copy(frag_header.dest, orig_node->orig); 485 ether_addr_copy(frag_header.dest, orig_node->orig);
477 486
diff --git a/net/batman-adv/packet.h b/net/batman-adv/packet.h
index 372128ddb474..71567794df17 100644
--- a/net/batman-adv/packet.h
+++ b/net/batman-adv/packet.h
@@ -420,6 +420,7 @@ struct batadv_unicast_4addr_packet {
420 * @dest: final destination used when routing fragments 420 * @dest: final destination used when routing fragments
421 * @orig: originator of the fragment used when merging the packet 421 * @orig: originator of the fragment used when merging the packet
422 * @no: fragment number within this sequence 422 * @no: fragment number within this sequence
423 * @priority: priority of frame, from ToS IP precedence or 802.1p
423 * @reserved: reserved byte for alignment 424 * @reserved: reserved byte for alignment
424 * @seqno: sequence identification 425 * @seqno: sequence identification
425 * @total_size: size of the merged packet 426 * @total_size: size of the merged packet
@@ -430,9 +431,11 @@ struct batadv_frag_packet {
430 u8 ttl; 431 u8 ttl;
431#if defined(__BIG_ENDIAN_BITFIELD) 432#if defined(__BIG_ENDIAN_BITFIELD)
432 u8 no:4; 433 u8 no:4;
433 u8 reserved:4; 434 u8 priority:3;
435 u8 reserved:1;
434#elif defined(__LITTLE_ENDIAN_BITFIELD) 436#elif defined(__LITTLE_ENDIAN_BITFIELD)
435 u8 reserved:4; 437 u8 reserved:1;
438 u8 priority:3;
436 u8 no:4; 439 u8 no:4;
437#else 440#else
438#error "unknown bitfield endianness" 441#error "unknown bitfield endianness"
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index f75091c983ee..24fc75335b31 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -1006,6 +1006,8 @@ int batadv_recv_frag_packet(struct sk_buff *skb,
1006 if (!orig_node_src) 1006 if (!orig_node_src)
1007 goto out; 1007 goto out;
1008 1008
1009 skb->priority = frag_packet->priority + 256;
1010
1009 /* Route the fragment if it is not for us and too big to be merged. */ 1011 /* Route the fragment if it is not for us and too big to be merged. */
1010 if (!batadv_is_my_mac(bat_priv, frag_packet->dest) && 1012 if (!batadv_is_my_mac(bat_priv, frag_packet->dest) &&
1011 batadv_frag_skb_fwd(skb, recv_if, orig_node_src)) { 1013 batadv_frag_skb_fwd(skb, recv_if, orig_node_src)) {