Skip to content

Commit eb072c4

Browse files
Eyal Perrydavem330
authored andcommitted
RDMA/cma: Set IBoE SL (user-priority) by egress map when using vlans
On top of commit 366cddb "IB/rdma_cm: TOS <=> UP mapping for IBoE", add support for case vlan egress map is used. When the IBoE session is being set over a vlan, inherit the socket priority to vlan priority mapping which was configured for the vlan device egress map. Signed-off-by: Eyal Perry <[email protected]> Signed-off-by: Amir Vadai <[email protected]> Signed-off-by: Or Gerlitz <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent d324353 commit eb072c4

File tree

1 file changed

+21
-5
lines changed
  • drivers/infiniband/core

1 file changed

+21
-5
lines changed

drivers/infiniband/core/cma.c

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1848,6 +1848,26 @@ static int cma_resolve_iw_route(struct rdma_id_private *id_priv, int timeout_ms)
18481848
return 0;
18491849
}
18501850

1851+
static int iboe_tos_to_sl(struct net_device *ndev, int tos)
1852+
{
1853+
int prio;
1854+
struct net_device *dev;
1855+
1856+
prio = rt_tos2priority(tos);
1857+
dev = ndev->priv_flags & IFF_802_1Q_VLAN ?
1858+
vlan_dev_real_dev(ndev) : ndev;
1859+
1860+
if (dev->num_tc)
1861+
return netdev_get_prio_tc_map(dev, prio);
1862+
1863+
#if IS_ENABLED(CONFIG_VLAN_8021Q)
1864+
if (ndev->priv_flags & IFF_802_1Q_VLAN)
1865+
return (vlan_dev_get_egress_qos_mask(ndev, prio) &
1866+
VLAN_PRIO_MASK) >> VLAN_PRIO_SHIFT;
1867+
#endif
1868+
return 0;
1869+
}
1870+
18511871
static int cma_resolve_iboe_route(struct rdma_id_private *id_priv)
18521872
{
18531873
struct rdma_route *route = &id_priv->id.route;
@@ -1888,11 +1908,7 @@ static int cma_resolve_iboe_route(struct rdma_id_private *id_priv)
18881908
route->path_rec->reversible = 1;
18891909
route->path_rec->pkey = cpu_to_be16(0xffff);
18901910
route->path_rec->mtu_selector = IB_SA_EQ;
1891-
route->path_rec->sl = netdev_get_prio_tc_map(
1892-
ndev->priv_flags & IFF_802_1Q_VLAN ?
1893-
vlan_dev_real_dev(ndev) : ndev,
1894-
rt_tos2priority(id_priv->tos));
1895-
1911+
route->path_rec->sl = iboe_tos_to_sl(ndev, id_priv->tos);
18961912
route->path_rec->mtu = iboe_get_mtu(ndev->mtu);
18971913
route->path_rec->rate_selector = IB_SA_EQ;
18981914
route->path_rec->rate = iboe_get_rate(ndev);

0 commit comments

Comments
 (0)