Skip to contentSkip to conversation

New GID query API broke EFA

DISCUSSION Gal Pressman 3 participants 9 messages Oct 22, 2020 InfiniBand

lore
Share & tools
lore
#0 lore raw

Hi all,

The new IOCTL query GID API 9f85cbe50aa0 ("RDMA/uverbs: Expose the new GID query API to user space") currently breaks EFA, as ibv_query_gid() no longer works.

The problem is that the IOCTL call checks for:

	if (!rdma_ib_or_roce(ib_dev, port_num))
		return -EOPNOTSUPP;

EFA is neither of these, but it uses GIDs.

Any objections to remove the check? Any other solutions come to mind?

Gal

maintainer
#1 lore raw
Quoted 5 lines · Gal Pressman

Hi all,

The new IOCTL query GID API 9f85cbe50aa0 ("RDMA/uverbs: Expose the new GID query API to user space") currently breaks EFA, as ibv_query_gid() no longer works.

Quoted 7 lines

The problem is that the IOCTL call checks for:

	if (!rdma_ib_or_roce(ib_dev, port_num))
		return -EOPNOTSUPP;

EFA is neither of these, but it uses GIDs.

Any objections to remove the check? Any other solutions come to mind?

We added this check to protect access to rdma_get_gid_attr() for devices without GID table.
1234 table = rdma_gid_table(device, port_num);
1235 if (index < 0 || index >= table->sz)
1236 return ERR_PTR(-EINVAL);

So you can extend that function to return for table == NULL an error and remove rdma_ib_or_roce()

Thanks

Quoted 2 lines

Gal

#2 lore raw
Quoted 14 lines · Leon Romanovsky
Quoted 5 lines · Gal Pressman

Hi all,

The new IOCTL query GID API 9f85cbe50aa0 ("RDMA/uverbs: Expose the new GID query API to user space") currently breaks EFA, as ibv_query_gid() no longer works.

Quoted 7 lines

The problem is that the IOCTL call checks for:

      if (!rdma_ib_or_roce(ib_dev, port_num))
              return -EOPNOTSUPP;

EFA is neither of these, but it uses GIDs.

Any objections to remove the check? Any other solutions come to mind?

Quoted 8 lines

We added this check to protect access to rdma_get_gid_attr() for devices without GID table.
1234 table = rdma_gid_table(device, port_num);
1235 if (index < 0 || index >= table->sz)
1236 return ERR_PTR(-EINVAL);

So you can extend that function to return for table == NULL an error and remove rdma_ib_or_roce()

Thanks Leon, I will send a patch.

maintainer
#3 lore raw
In reply to Leon Romanovsky
Quoted 14 lines · Leon Romanovsky
Quoted 5 lines · Gal Pressman

Hi all,

The new IOCTL query GID API 9f85cbe50aa0 ("RDMA/uverbs: Expose the new GID query API to user space") currently breaks EFA, as ibv_query_gid() no longer works.

Quoted 7 lines

The problem is that the IOCTL call checks for:

	if (!rdma_ib_or_roce(ib_dev, port_num))
		return -EOPNOTSUPP;

EFA is neither of these, but it uses GIDs.

Any objections to remove the check? Any other solutions come to mind?

Quoted 8 lines

We added this check to protect access to rdma_get_gid_attr() for devices without GID table.
1234 table = rdma_gid_table(device, port_num);
1235 if (index < 0 || index >= table->sz)
1236 return ERR_PTR(-EINVAL);

So you can extend that function to return for table == NULL an error and remove rdma_ib_or_roce()

How does table == NULL ever?

Jason

#4 lore raw
Quoted 21 lines · Jason Gunthorpe
Quoted 20 lines · Leon Romanovsky
Quoted 5 lines · Gal Pressman

Hi all,

The new IOCTL query GID API 9f85cbe50aa0 ("RDMA/uverbs: Expose the new GID query API to user space") currently breaks EFA, as ibv_query_gid() no longer works.

Quoted 7 lines

The problem is that the IOCTL call checks for:

    if (!rdma_ib_or_roce(ib_dev, port_num))
            return -EOPNOTSUPP;

EFA is neither of these, but it uses GIDs.

Any objections to remove the check? Any other solutions come to mind?

We added this check to protect access to rdma_get_gid_attr() for devices without GID table.
1234 table = rdma_gid_table(device, port_num);
1235 if (index < 0 || index >= table->sz)
1236 return ERR_PTR(-EINVAL);

Quoted 4 lines
Quoted 2 lines

So you can extend that function to return for table == NULL an error and remove rdma_ib_or_roce()

How does table == NULL ever?

A driver with gid_tbl_len == 0 would make the allocation return NULL, no?

#5 lore raw
Quoted 22 lines · Gal Pressman
Quoted 21 lines · Jason Gunthorpe
Quoted 20 lines · Leon Romanovsky
Quoted 5 lines · Gal Pressman

Hi all,

The new IOCTL query GID API 9f85cbe50aa0 ("RDMA/uverbs: Expose the new GID query API to user space") currently breaks EFA, as ibv_query_gid() no longer works.

Quoted 7 lines

The problem is that the IOCTL call checks for:

    if (!rdma_ib_or_roce(ib_dev, port_num))
            return -EOPNOTSUPP;

EFA is neither of these, but it uses GIDs.

Any objections to remove the check? Any other solutions come to mind?

We added this check to protect access to rdma_get_gid_attr() for devices without GID table.
1234 table = rdma_gid_table(device, port_num);
1235 if (index < 0 || index >= table->sz)
1236 return ERR_PTR(-EINVAL);

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

So you can extend that function to return for table == NULL an error and remove rdma_ib_or_roce()

How does table == NULL ever?

A driver with gid_tbl_len == 0 would make the allocation return NULL, no?

Nevermind, we don't really allocate with gid_tbl_len as the size, and any allocation failure will fail ib_register_device().
So I guess there is no way for it to be NULL.

maintainer
#6 lore raw
Quoted 26 lines · Gal Pressman
Quoted 25 lines · Gal Pressman
Quoted 24 lines · Jason Gunthorpe
Quoted 22 lines · Leon Romanovsky
Quoted 5 lines · Gal Pressman

Hi all,

The new IOCTL query GID API 9f85cbe50aa0 ("RDMA/uverbs: Expose the new GID query API to user space") currently breaks EFA, as ibv_query_gid() no longer works.

Quoted 7 lines

The problem is that the IOCTL call checks for:

    if (!rdma_ib_or_roce(ib_dev, port_num))
            return -EOPNOTSUPP;

EFA is neither of these, but it uses GIDs.

Any objections to remove the check? Any other solutions come to mind?

We added this check to protect access to rdma_get_gid_attr() for devices without GID table.
1234 table = rdma_gid_table(device, port_num);
1235 if (index < 0 || index >= table->sz)
1236 return ERR_PTR(-EINVAL);

So you can extend that function to return for table == NULL an error and remove rdma_ib_or_roce()

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

How does table == NULL ever?

A driver with gid_tbl_len == 0 would make the allocation return NULL, no?

Nevermind, we don't really allocate with gid_tbl_len as the size, and any allocation failure will fail ib_register_device().
So I guess there is no way for it to be NULL.

I think so too.

Thanks

maintainer
#7 lore raw
In reply to Jason Gunthorpe
Quoted 21 lines · Jason Gunthorpe
Quoted 20 lines · Leon Romanovsky
Quoted 5 lines · Gal Pressman

Hi all,

The new IOCTL query GID API 9f85cbe50aa0 ("RDMA/uverbs: Expose the new GID query API to user space") currently breaks EFA, as ibv_query_gid() no longer works.

Quoted 7 lines

The problem is that the IOCTL call checks for:

	if (!rdma_ib_or_roce(ib_dev, port_num))
		return -EOPNOTSUPP;

EFA is neither of these, but it uses GIDs.

Any objections to remove the check? Any other solutions come to mind?

We added this check to protect access to rdma_get_gid_attr() for devices without GID table.
1234 table = rdma_gid_table(device, port_num);
1235 if (index < 0 || index >= table->sz)
1236 return ERR_PTR(-EINVAL);

Quoted 4 lines
Quoted 2 lines

So you can extend that function to return for table == NULL an error and remove rdma_ib_or_roce()

How does table == NULL ever?

ok, you are right in that regards.
However, mlx5 IB representors don't support GIDs and sets gid_tbl_len to be zero. Do we want to rely on the assumption that table will always exist?

Thanks

Quoted 2 lines

Jason

maintainer
#8 lore raw
Quoted 22 lines · Leon Romanovsky
Quoted 21 lines · Jason Gunthorpe
Quoted 20 lines · Leon Romanovsky
Quoted 5 lines · Gal Pressman

Hi all,

The new IOCTL query GID API 9f85cbe50aa0 ("RDMA/uverbs: Expose the new GID query API to user space") currently breaks EFA, as ibv_query_gid() no longer works.

Quoted 7 lines

The problem is that the IOCTL call checks for:

	if (!rdma_ib_or_roce(ib_dev, port_num))
		return -EOPNOTSUPP;

EFA is neither of these, but it uses GIDs.

Any objections to remove the check? Any other solutions come to mind?

We added this check to protect access to rdma_get_gid_attr() for devices without GID table.
1234 table = rdma_gid_table(device, port_num);
1235 if (index < 0 || index >= table->sz)
1236 return ERR_PTR(-EINVAL);

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

So you can extend that function to return for table == NULL an error and remove rdma_ib_or_roce()

How does table == NULL ever?

ok, you are right in that regards.
However, mlx5 IB representors don't support GIDs and sets gid_tbl_len to be zero. Do we want to rely on the assumption that table will always exist?

We do already, seems like the rdma_ib_or_roce should just be deleted

Jason