All of lore.kernel.org
 help / color / mirror / Atom feed
From: Amir Vadai <amirv@mellanox.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org, Roland Dreier <roland@purestorage.com>,
	Oren Duer <oren@mellanox.com>, Amir Vadai <amirv@mellanox.co.il>,
	Sean Hefty <sean.hefty@intel.com>
Subject: [PATCH 6/8] IB/rdma_cm: TOS <=> UP mapping for IBoE
Date: Tue, 13 Mar 2012 19:22:01 +0200	[thread overview]
Message-ID: <1331659323-12904-7-git-send-email-amirv@mellanox.com> (raw)
In-Reply-To: <1331659323-12904-1-git-send-email-amirv@mellanox.com>

From: Amir Vadai <amirv@mellanox.co.il>

Both tagged traffic and untagged traffic use tc tool mapping.
Treat RDMA TOS same as IP TOS when mapping to SL

Since IP TOS to priority mapping is not exported, had to borrow the code from
net/ipv4/route.c

Signed-off-by: Amir Vadai <amirv@mellanox.co.il>
CC: Sean Hefty <sean.hefty@intel.com>

---

We can export IP TOS to priority mapping if the networking maintainers will say
where they want it.
---
 drivers/infiniband/core/cma.c |   35 ++++++++++++++++++++++++++++++++++-
 1 files changed, 34 insertions(+), 1 deletions(-)

diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index e3e470f..c0eeb2c 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -42,6 +42,7 @@
 #include <linux/inetdevice.h>
 #include <linux/slab.h>
 #include <linux/module.h>
+#include <linux/pkt_sched.h>
 
 #include <net/tcp.h>
 #include <net/ipv6.h>
@@ -1781,6 +1782,32 @@ static int cma_resolve_iw_route(struct rdma_id_private *id_priv, int timeout_ms)
 	return 0;
 }
 
+#define ECN_OR_COST(class)	TC_PRIO_##class
+
+static const __u8 tos2prio[16] = {
+	TC_PRIO_BESTEFFORT,
+	ECN_OR_COST(BESTEFFORT),
+	TC_PRIO_BESTEFFORT,
+	ECN_OR_COST(BESTEFFORT),
+	TC_PRIO_BULK,
+	ECN_OR_COST(BULK),
+	TC_PRIO_BULK,
+	ECN_OR_COST(BULK),
+	TC_PRIO_INTERACTIVE,
+	ECN_OR_COST(INTERACTIVE),
+	TC_PRIO_INTERACTIVE,
+	ECN_OR_COST(INTERACTIVE),
+	TC_PRIO_INTERACTIVE_BULK,
+	ECN_OR_COST(INTERACTIVE_BULK),
+	TC_PRIO_INTERACTIVE_BULK,
+	ECN_OR_COST(INTERACTIVE_BULK)
+};
+
+static inline char cma_tos2priority(u8 tos)
+{
+	return tos2prio[IPTOS_TOS(tos)>>1];
+}
+
 static int cma_resolve_iboe_route(struct rdma_id_private *id_priv)
 {
 	struct rdma_route *route = &id_priv->id.route;
@@ -1826,7 +1853,13 @@ static int cma_resolve_iboe_route(struct rdma_id_private *id_priv)
 	route->path_rec->reversible = 1;
 	route->path_rec->pkey = cpu_to_be16(0xffff);
 	route->path_rec->mtu_selector = IB_SA_EQ;
-	route->path_rec->sl = id_priv->tos >> 5;
+	if (ndev->priv_flags & IFF_802_1Q_VLAN)
+		route->path_rec->sl =
+			netdev_get_prio_tc_map(vlan_dev_real_dev(ndev),
+					cma_tos2priority(id_priv->tos));
+	else
+		route->path_rec->sl = netdev_get_prio_tc_map(ndev,
+				cma_tos2priority(id_priv->tos));
 
 	route->path_rec->mtu = iboe_get_mtu(ndev->mtu);
 	route->path_rec->rate_selector = IB_SA_EQ;
-- 
1.7.8.2

  parent reply	other threads:[~2012-03-13 17:23 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-13 17:21 [PATCH 0/8] net/mlx4_en: DCB QoS support Amir Vadai
2012-03-13 17:21 ` [PATCH 1/8] net/mlx4_en: Force user priority by QP attribute Amir Vadai
2012-03-13 17:21 ` [PATCH 2/8] net/mlx4_core: set port QoS attributes Amir Vadai
2012-03-13 17:21 ` [PATCH 3/8] net/mlx4_en: DCB QoS support Amir Vadai
2012-03-13 17:21 ` [PATCH 4/8] net/mlx4_en: Set max rate-limit for a TC Amir Vadai
2012-03-13 18:26   ` John Fastabend
2012-03-14 10:31     ` Amir Vadai
2012-03-13 19:16   ` Dave Taht
2012-03-14 10:42     ` Amir Vadai
2012-03-13 17:22 ` [PATCH 5/8] net/mlx4_en: sk_prio <=> UP for untagged traffic Amir Vadai
2012-03-13 17:22 ` Amir Vadai [this message]
2012-03-13 17:22 ` [PATCH 7/8] net: support tx_ring per UP in HW based QoS mechanism Amir Vadai
2012-03-13 18:23   ` John Fastabend
2012-03-14 10:09     ` Amir Vadai
2012-03-14 21:36       ` John Fastabend
2012-03-15 10:05         ` Amir Vadai
2012-03-16  7:16           ` John Fastabend
2012-03-13 17:22 ` [PATCH 8/8] net/mlx4_en: num cores tx rings for every UP Amir Vadai
2012-03-20 11:29 ` [PATCH 0/8] net/mlx4_en: DCB QoS support Amir Vadai
2012-03-20 19:58   ` 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=1331659323-12904-7-git-send-email-amirv@mellanox.com \
    --to=amirv@mellanox.com \
    --cc=amirv@mellanox.co.il \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=oren@mellanox.com \
    --cc=roland@purestorage.com \
    --cc=sean.hefty@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.