netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Wunderlich <sw-2YrNx6rUIHYiY0qSoAWiAoQuADTiUCJX@public.gmane.org>
To: davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org
Cc: Marek Lindner
	<mareklindner-rVWd3aGhH2z5bpWLKbzFeg@public.gmane.org>,
	netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r@public.gmane.org
Subject: [PATCH 13/17] batman-adv: Include frame priority in fragment header
Date: Fri,  1 Jul 2016 15:09:05 +0200	[thread overview]
Message-ID: <1467378549-9646-14-git-send-email-sw@simonwunderlich.de> (raw)
In-Reply-To: <1467378549-9646-1-git-send-email-sw-2YrNx6rUIHYiY0qSoAWiAoQuADTiUCJX@public.gmane.org>

From: Andrew Lunn <andrew-g2DYL2Zd6BY@public.gmane.org>

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-g2DYL2Zd6BY@public.gmane.org>
Signed-off-by: Marek Lindner <mareklindner-rVWd3aGhH2z5bpWLKbzFeg@public.gmane.org>
Signed-off-by: Sven Eckelmann <sven-KaDOiPu9UxWEi8DpZVb4nw@public.gmane.org>
Signed-off-by: Simon Wunderlich <sw-2YrNx6rUIHYiY0qSoAWiAoQuADTiUCJX@public.gmane.org>
---
 net/batman-adv/fragmentation.c | 9 +++++++++
 net/batman-adv/packet.h        | 7 +++++--
 net/batman-adv/routing.c       | 2 ++
 3 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/net/batman-adv/fragmentation.c b/net/batman-adv/fragmentation.c
index a119b6a..9f41a0a 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,
 	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);
 
diff --git a/net/batman-adv/packet.h b/net/batman-adv/packet.h
index 372128d..7156779 100644
--- a/net/batman-adv/packet.h
+++ b/net/batman-adv/packet.h
@@ -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"
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index f75091c..24fc753 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,
 	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)) {
-- 
2.8.1

  parent reply	other threads:[~2016-07-01 13:09 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-01 13:08 pull request for net-next: batman-adv 2016-07-01 Simon Wunderlich
     [not found] ` <1467378549-9646-1-git-send-email-sw-2YrNx6rUIHYiY0qSoAWiAoQuADTiUCJX@public.gmane.org>
2016-07-01 13:08   ` [PATCH 01/17] batman-adv: Start new development cycle Simon Wunderlich
2016-07-01 13:08   ` [PATCH 02/17] batman-adv: statically print gateway table header Simon Wunderlich
2016-07-01 17:19     ` Joe Perches
2016-07-01 13:08   ` [PATCH 03/17] batman-adv: remove unused vid local variable in tt seq print Simon Wunderlich
2016-07-01 13:08   ` [PATCH 04/17] batman-adv: document sysfs files in alphabetical order Simon Wunderlich
2016-07-01 13:08   ` [PATCH 05/17] batman-adv: update elp interval documentation Simon Wunderlich
2016-07-01 13:08   ` [PATCH 06/17] batman-adv: refactor batadv_neigh_node_* functions to follow common style Simon Wunderlich
2016-07-01 13:08   ` [PATCH 07/17] batman-adv: remove unused callback from batadv_algo_ops struct Simon Wunderlich
2016-07-01 13:09   ` [PATCH 08/17] batman-adv: remove ogm_emit and ogm_schedule API calls Simon Wunderlich
2016-07-01 13:09   ` [PATCH 09/17] batman-adv: remove useless inline attribute for sysfs helper function Simon Wunderlich
2016-07-01 13:09   ` [PATCH 10/17] batman-adv: move GW mode and selection class to private data structure Simon Wunderlich
2016-07-01 13:09   ` [PATCH 11/17] batman-adv: init ELP tweaking options only once Simon Wunderlich
2016-07-01 13:09   ` [PATCH 12/17] batman-adv: Set skb priority in fragments Simon Wunderlich
2016-07-01 13:09   ` Simon Wunderlich [this message]
2016-07-01 13:09   ` [PATCH 14/17] batman-adv: Always flood IGMP/MLD reports Simon Wunderlich
2016-07-01 13:09   ` [PATCH 15/17] batman-adv: Add multicast optimization support for bridged setups Simon Wunderlich
2016-07-01 13:09   ` [PATCH 16/17] batman-adv: Adding logging of mcast flag changes Simon Wunderlich
2016-07-01 13:09   ` [PATCH 17/17] batman-adv: Add debugfs table for mcast flags Simon Wunderlich
2016-07-01 21:05   ` pull request for net-next: batman-adv 2016-07-01 David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1467378549-9646-14-git-send-email-sw@simonwunderlich.de \
    --to=sw-2yrnx6ruihyiy0qsoawiaoquadtiucjx@public.gmane.org \
    --cc=b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r@public.gmane.org \
    --cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
    --cc=mareklindner-rVWd3aGhH2z5bpWLKbzFeg@public.gmane.org \
    --cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).