Add ibv_query_gid_type to support RoCE v2 UD traffic

Currently, libibverbs does not support UD traffic for RoCE v2 since
it can't differ between v1 and v2 GIDs (both have the same GID, only
the version is different). This means that GID index can't be
selected correctly.

This patch introduces ibv_query_gid_type helper function to be used
by libibverbs and its vendors to return GID type based on its GID
index by using the relevant sysfs.

Signed-off-by: Noa Osherovich <>
Reviewed-by: Yishai Hadas <>
Signed-off-by: Doug Ledford <>
3 files changed