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 V1 6/6] IB/rdma_cm: TOS <=> UP mapping for IBoE
Date: Wed, 21 Mar 2012 11:25:03 +0200 [thread overview]
Message-ID: <1332321903-11704-7-git-send-email-amirv@mellanox.com> (raw)
In-Reply-To: <1332321903-11704-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
next prev parent reply other threads:[~2012-03-21 9:25 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-21 9:24 [PATCH V1 0/6] net/mlx4_en: DCB QoS support Amir Vadai
2012-03-21 9:24 ` [PATCH V1 1/6] net/mlx4_en: Force user priority by QP attribute Amir Vadai
2012-03-21 9:24 ` [PATCH V1 2/6] net/mlx4_core: set port QoS attributes Amir Vadai
2012-03-21 9:25 ` [PATCH V1 3/6] net/mlx4_en: DCB QoS support Amir Vadai
2012-03-21 9:25 ` [PATCH V1 4/6] net/mlx4_en: Set max rate-limit for a TC Amir Vadai
2012-03-21 10:12 ` Eric Dumazet
2012-03-21 13:43 ` Amir Vadai
2012-03-21 9:25 ` [PATCH V1 5/6] net/mlx4_en: sk_prio <=> UP for untagged traffic Amir Vadai
2012-03-21 14:20 ` John Fastabend
2012-03-21 15:18 ` Amir Vadai
2012-03-21 9:25 ` Amir Vadai [this message]
2012-03-21 10:03 ` [PATCH V1 6/6] IB/rdma_cm: TOS <=> UP mapping for IBoE Eric Dumazet
2012-03-21 13:26 ` Amir Vadai
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=1332321903-11704-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 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).