Re: [PATCH v5 4/4] RDMA/cma: Avoid GID lookups on iWARP devices

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> On Jul 1, 2023, at 12:24 PM, Tom Talpey <tom@xxxxxxxxxx> wrote:
> 
> On 6/29/2023 11:16 AM, Chuck Lever wrote:
>> From: Chuck Lever <chuck.lever@xxxxxxxxxx>
>> We would like to enable the use of siw on top of a VPN that is
>> constructed and managed via a tun device. That hasn't worked up
>> until now because ARPHRD_NONE devices (such as tun devices) have
>> no GID for the RDMA/core to look up.
>> But it turns out that the egress device has already been picked for
>> us -- no GID is necessary. addr_handler() just has to do the right
>> thing with it.
>> Suggested-by: Jason Gunthorpe <jgg@xxxxxxxxxx>
>> Signed-off-by: Chuck Lever <chuck.lever@xxxxxxxxxx>
>> ---
>>  drivers/infiniband/core/cma.c |   15 +++++++++++++++
>>  1 file changed, 15 insertions(+)
>> diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
>> index 889b3e4ea980..07bb5ac4019d 100644
>> --- a/drivers/infiniband/core/cma.c
>> +++ b/drivers/infiniband/core/cma.c
>> @@ -700,6 +700,21 @@ cma_validate_port(struct ib_device *device, u32 port,
>>   if ((dev_type != ARPHRD_INFINIBAND) && rdma_protocol_ib(device, port))
>>   goto out;
>>  + /* Linux iWARP devices have but one port */
> 
> I don't believe this comment is correct, or necessary. In-tree drivers
> exist for several multi-port iWARP devices, and the port bnumber passed
> to rdma_protocol_iwarp() and rdma_get_gid_attr() will follow, no?

Then I must have misunderstood what Jason said about the reason
for the rdma_protocol_iwarp() check. He said that we are able to
do this kind of GID lookup because iWARP devices have only a
single port.

Jason?


> The code looks correct otherwise...
> 
> Tom.
> 
>> + if (rdma_protocol_iwarp(device, port)) {
>> + sgid_attr = rdma_get_gid_attr(device, port, 0);
>> + if (IS_ERR(sgid_attr))
>> + goto out;
>> +
>> + rcu_read_lock();
>> + ndev = rcu_dereference(sgid_attr->ndev);
>> + if (!net_eq(dev_net(ndev), dev_addr->net) ||
>> +     ndev->ifindex != bound_if_index)
>> + sgid_attr = ERR_PTR(-ENODEV);
>> + rcu_read_unlock();
>> + goto out;
>> + }
>> +
>>   if (dev_type == ARPHRD_ETHER && rdma_protocol_roce(device, port)) {
>>   ndev = dev_get_by_index(dev_addr->net, bound_if_index);
>>   if (!ndev)


--
Chuck Lever






[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux