@@ -72,9 +72,9 @@ enum verbs_qp_mask {
VERBS_QP_EX = 1 << 1,
};
-enum ibv_gid_type {
- IBV_GID_TYPE_IB_ROCE_V1,
- IBV_GID_TYPE_ROCE_V2,
+enum ibv_gid_type_sysfs {
+ IBV_GID_TYPE_SYSFS_IB_ROCE_V1,
+ IBV_GID_TYPE_SYSFS_ROCE_V2,
};
enum ibv_mr_type {
@@ -653,7 +653,7 @@ static inline bool check_comp_mask(uint64_t input, uint64_t supported)
}
int ibv_query_gid_type(struct ibv_context *context, uint8_t port_num,
- unsigned int index, enum ibv_gid_type *type);
+ unsigned int index, enum ibv_gid_type_sysfs *type);
static inline int
ibv_check_alloc_parent_domain(struct ibv_parent_domain_init_attr *attr)
@@ -164,17 +164,17 @@ static const char *vl_str(uint8_t vl_num)
}
#define DEVINFO_INVALID_GID_TYPE 2
-static const char *gid_type_str(enum ibv_gid_type type)
+static const char *gid_type_str(enum ibv_gid_type_sysfs type)
{
switch (type) {
- case IBV_GID_TYPE_IB_ROCE_V1: return "RoCE v1";
- case IBV_GID_TYPE_ROCE_V2: return "RoCE v2";
+ case IBV_GID_TYPE_SYSFS_IB_ROCE_V1: return "RoCE v1";
+ case IBV_GID_TYPE_SYSFS_ROCE_V2: return "RoCE v2";
default: return "Invalid gid type";
}
}
static void print_formated_gid(union ibv_gid *gid, int i,
- enum ibv_gid_type type, int ll)
+ enum ibv_gid_type_sysfs type, int ll)
{
char gid_str[INET6_ADDRSTRLEN] = {};
char str[20] = {};
@@ -182,7 +182,7 @@ static void print_formated_gid(union ibv_gid *gid, int i,
if (ll == IBV_LINK_LAYER_ETHERNET)
sprintf(str, ", %s", gid_type_str(type));
- if (type == IBV_GID_TYPE_IB_ROCE_V1)
+ if (type == IBV_GID_TYPE_SYSFS_IB_ROCE_V1)
printf("\t\t\tGID[%3d]:\t\t%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x%s\n",
i, gid->raw[0], gid->raw[1], gid->raw[2],
gid->raw[3], gid->raw[4], gid->raw[5], gid->raw[6],
@@ -190,7 +190,7 @@ static void print_formated_gid(union ibv_gid *gid, int i,
gid->raw[11], gid->raw[12], gid->raw[13], gid->raw[14],
gid->raw[15], str);
- if (type == IBV_GID_TYPE_ROCE_V2) {
+ if (type == IBV_GID_TYPE_SYSFS_ROCE_V2) {
inet_ntop(AF_INET6, gid->raw, gid_str, sizeof(gid_str));
printf("\t\t\tGID[%3d]:\t\t%s%s\n", i, gid_str, str);
}
@@ -200,7 +200,7 @@ static int print_all_port_gids(struct ibv_context *ctx,
struct ibv_port_attr *port_attr,
uint8_t port_num)
{
- enum ibv_gid_type type;
+ enum ibv_gid_type_sysfs type;
union ibv_gid gid;
int tbl_len;
int rc = 0;
@@ -704,7 +704,7 @@ LATEST_SYMVER_FUNC(ibv_create_ah, 1_1, "IBVERBS_1.1",
#define V1_TYPE "IB/RoCE v1"
#define V2_TYPE "RoCE v2"
int ibv_query_gid_type(struct ibv_context *context, uint8_t port_num,
- unsigned int index, enum ibv_gid_type *type)
+ unsigned int index, enum ibv_gid_type_sysfs *type)
{
struct verbs_device *verbs_device = verbs_get_device(context->device);
char buff[11];
@@ -723,7 +723,7 @@ int ibv_query_gid_type(struct ibv_context *context, uint8_t port_num,
/* In IB, this file doesn't exist and the kernel sets
* errno to -EINVAL.
*/
- *type = IBV_GID_TYPE_IB_ROCE_V1;
+ *type = IBV_GID_TYPE_SYSFS_IB_ROCE_V1;
return 0;
}
if (asprintf(&dir_path, "%s/%s/%d/%s/",
@@ -738,7 +738,7 @@ int ibv_query_gid_type(struct ibv_context *context, uint8_t port_num,
* we have an old kernel and all GIDs are
* IB/RoCE v1
*/
- *type = IBV_GID_TYPE_IB_ROCE_V1;
+ *type = IBV_GID_TYPE_SYSFS_IB_ROCE_V1;
else
return -1;
} else {
@@ -748,9 +748,9 @@ int ibv_query_gid_type(struct ibv_context *context, uint8_t port_num,
}
} else {
if (!strcmp(buff, V1_TYPE)) {
- *type = IBV_GID_TYPE_IB_ROCE_V1;
+ *type = IBV_GID_TYPE_SYSFS_IB_ROCE_V1;
} else if (!strcmp(buff, V2_TYPE)) {
- *type = IBV_GID_TYPE_ROCE_V2;
+ *type = IBV_GID_TYPE_SYSFS_ROCE_V2;
} else {
errno = ENOTSUP;
return -1;
@@ -761,9 +761,10 @@ int ibv_query_gid_type(struct ibv_context *context, uint8_t port_num,
}
static int ibv_find_gid_index(struct ibv_context *context, uint8_t port_num,
- union ibv_gid *gid, enum ibv_gid_type gid_type)
+ union ibv_gid *gid,
+ enum ibv_gid_type_sysfs gid_type)
{
- enum ibv_gid_type sgid_type = 0;
+ enum ibv_gid_type_sysfs sgid_type = 0;
union ibv_gid sgid;
int i = 0, ret;
@@ -863,7 +864,7 @@ static inline int set_ah_attr_by_ipv4(struct ibv_context *context,
map_ipv4_addr_to_ipv6(ip4h->daddr, (struct in6_addr *)&sgid);
ret = ibv_find_gid_index(context, port_num, &sgid,
- IBV_GID_TYPE_ROCE_V2);
+ IBV_GID_TYPE_SYSFS_ROCE_V2);
if (ret < 0)
return ret;
@@ -893,9 +894,9 @@ static inline int set_ah_attr_by_ipv6(struct ibv_context *context,
ah_attr->grh.dgid = grh->sgid;
if (grh->next_hdr == IPPROTO_UDP) {
- sgid_type = IBV_GID_TYPE_ROCE_V2;
+ sgid_type = IBV_GID_TYPE_SYSFS_ROCE_V2;
} else if (grh->next_hdr == IB_NEXT_HDR) {
- sgid_type = IBV_GID_TYPE_IB_ROCE_V1;
+ sgid_type = IBV_GID_TYPE_SYSFS_IB_ROCE_V1;
} else {
errno = EPROTONOSUPPORT;
return -1;
@@ -2955,7 +2955,7 @@ struct ibv_ah *mlx5_create_ah(struct ibv_pd *pd, struct ibv_ah_attr *attr)
attr->grh.sgid_index, &gid_type))
goto err;
- if (gid_type == IBV_GID_TYPE_ROCE_V2)
+ if (gid_type == IBV_GID_TYPE_SYSFS_ROCE_V2)
mlx5_ah_set_udp_sport(ah, attr);
/* Since RoCE packets must contain GRH, this bit is reserved
@@ -220,7 +220,7 @@ cdef class Context(PyverbsCM):
return gid
def query_gid_type(self, unsigned int port_num, unsigned int index):
- cdef v.ibv_gid_type gid_type
+ cdef v.ibv_gid_type_sysfs gid_type
rc = v.ibv_query_gid_type(self.context, port_num, index, &gid_type)
if rc != 0:
raise PyverbsRDMAErrno('Failed to query gid type of port {p} and gid index {g}'
@@ -617,6 +617,6 @@ cdef extern from 'infiniband/verbs.h':
cdef extern from 'infiniband/driver.h':
int ibv_query_gid_type(ibv_context *context, uint8_t port_num,
- unsigned int index, ibv_gid_type *type)
+ unsigned int index, ibv_gid_type_sysfs *type)
int ibv_set_ece(ibv_qp *qp, ibv_ece *ece)
int ibv_query_ece(ibv_qp *qp, ibv_ece *ece)
@@ -443,6 +443,6 @@ _IBV_ADVISE_MR_FLAG_FLUSH = IBV_ADVISE_MR_FLAG_FLUSH
cdef extern from '<infiniband/driver.h>':
- cpdef enum ibv_gid_type:
- IBV_GID_TYPE_IB_ROCE_V1
- IBV_GID_TYPE_ROCE_V2
+ cpdef enum ibv_gid_type_sysfs:
+ IBV_GID_TYPE_SYSFS_IB_ROCE_V1
+ IBV_GID_TYPE_SYSFS_ROCE_V2
@@ -176,7 +176,8 @@ class RDMATestCase(unittest.TestCase):
continue
# Avoid RoCEv2 GIDs on unsupported devices
if port_attrs.link_layer == e.IBV_LINK_LAYER_ETHERNET and \
- ctx.query_gid_type(port, idx) == e.IBV_GID_TYPE_ROCE_V2 and \
+ ctx.query_gid_type(port, idx) == \
+ e.IBV_GID_TYPE_SYSFS_ROCE_V2 and \
has_roce_hw_bug(vendor_id, vendor_pid):
continue
if not os.path.exists('/sys/class/infiniband/{}/device/net/'.format(dev)):