In order to implement IP based addressing for UD QPs, we need a way to resolve the addresses internally. When the provider detects an Ethernet link layer with IP based gids, it calls a helper function in libibverbs in order to resolve the Ethernet L2 params. Signed-off-by: Matan Barak <matanb@xxxxxxxxxxxx> Signed-off-by: Or Gerlitz <ogerlitz@xxxxxxxxxxxx> --- src/verbs.c | 26 ++++++++++++++++++++++---- 1 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/verbs.c b/src/verbs.c index 5c069ea..831e934 100644 --- a/src/verbs.c +++ b/src/verbs.c @@ -856,11 +856,29 @@ struct ibv_ah *mlx4_create_ah(struct ibv_pd *pd, struct ibv_ah_attr *attr) memcpy(ah->av.dgid, attr->grh.dgid.raw, 16); } - if (port_attr.link_layer == IBV_LINK_LAYER_ETHERNET) - if (mlx4_resolve_grh_to_l2(pd, ah, attr)) { - free(ah); - return NULL; + if (port_attr.link_layer == IBV_LINK_LAYER_ETHERNET) { + if (port_attr.port_cap_flags & IBV_PORT_IP_BASED_GIDS) { + uint16_t vid; + + if (ibv_resolve_eth_l2_from_gid(pd->context, attr, + ah->mac, &vid)) { + free(ah); + return NULL; + } + + if (vid <= 0xfff) { + ah->av.port_pd |= htonl(1 << 29); + ah->vlan = vid | + ((attr->sl & 7) << 13); + } + + } else { + if (mlx4_resolve_grh_to_l2(pd, ah, attr)) { + free(ah); + return NULL; + } } + } return &ah->ibv_ah; } -- 1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html