Message ID | 1332321903-11704-7-git-send-email-amirv@mellanox.com |
---|---|
State | Changes Requested, archived |
Delegated to: | David Miller |
Headers | show |
Le mercredi 21 mars 2012 à 11:25 +0200, Amir Vadai a écrit : > 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. Yes please do so. This makes no sense to duplicate ip_tos2prio[] -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 03/21/2012 12:03 PM, Eric Dumazet wrote: > Le mercredi 21 mars 2012 à 11:25 +0200, Amir Vadai a écrit : >> 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. > > Yes please do so. This makes no sense to duplicate ip_tos2prio[] > Ok, I will add a patch to export ip_tos2prio, and will use in the code rt_tos2priority(). - Amir -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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;