linux/drivers/infiniband/hw
Håkon Bugge 227a0e142e IB/mlx4: Add support for REJ due to timeout
A CM REJ packet with its reason equal to timeout is a special beast in the
sense that it doesn't have a Remote Communication ID nor does it have a
Remote Port GID.

Using CX-3 virtual functions, either from a bare-metal machine or
pass-through from a VM, MAD packets are proxied through the PF driver.

Since the VF drivers have separate name spaces for MAD Transaction Ids
(TIDs), the PF driver has to re-map the TIDs and keep the book keeping
in a cache.

This proxying doesn't not handle said REJ packets.

If the active side abandons its connection attempt after having sent a
REQ, it will send a REJ with the reason being timeout. This example can be
provoked by a simple user-verbs program, which ends up doing:

    rdma_connect(cm_id, &conn_param);
    rdma_destroy_id(cm_id);

using the async librdmacm API.

Having dynamic debug prints enabled in the mlx4_ib driver, we will then
see:

mlx4_ib_demux_cm_handler: Couldn't find an entry for pv_cm_id 0x0, attr_id 0x12

The solution is to introduce a radix-tree. When a REQ packet is received
and handled in mlx4_ib_demux_cm_handler(), we know the connecting peer's
para-virtual cm_id and the destination slave. We then insert an entry into
the tree with said information. We also schedule work to remove this entry
from the tree and free it, in order to avoid memory leak.

When a REJ packet with reason timeout is received, we can look up the
slave in the tree, and deliver the packet to the correct slave.

When a duplicate REQ packet is received, the entry is in the tree. In this
case, we adjust the delayed work in order to avoid a too premature
eviction of the entry.

When cleaning up, we simply traverse the tree and modify any delayed work
to use a zero delay. A subsequent flush of the system_wq will ensure all
entries being wiped out.

Fixes: 3cf69cc8db ("IB/mlx4: Add CM paravirtualization")
Link: https://lore.kernel.org/r/20200803061941.1139994-6-haakon.bugge@oracle.com
Signed-off-by: Håkon Bugge <haakon.bugge@oracle.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
2020-08-24 11:31:22 -03:00
..
bnxt_re RDMA 5.9 merge window pull request 2020-08-06 16:43:36 -07:00
cxgb4 RDMA 5.9 merge window pull request 2020-08-06 16:43:36 -07:00
efa RDMA/efa: Introduce SRD RNR retry 2020-08-18 14:52:45 -03:00
hfi1 RDMA 5.9 merge window pull request 2020-08-06 16:43:36 -07:00
hns RDMA 5.9 merge window pull request 2020-08-06 16:43:36 -07:00
i40iw RDMA 5.9 merge window pull request 2020-08-06 16:43:36 -07:00
mlx4 IB/mlx4: Add support for REJ due to timeout 2020-08-24 11:31:22 -03:00
mlx5 RDMA/mlx5: Enable sniffer when device is in switchdev mode 2020-08-18 15:03:32 -03:00
mthca treewide: Remove uninitialized_var() usage 2020-07-16 12:35:15 -07:00
ocrdma RDMA: Remove the udata parameter from alloc_mr callback 2020-07-06 19:25:53 -03:00
qedr RDMA 5.9 merge window pull request 2020-08-06 16:43:36 -07:00
qib treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
usnic RDMA/usnic: switch from 'pci_' to 'dma_' API 2020-07-16 15:42:05 -03:00
vmw_pvrdma RDMA: Remove the udata parameter from alloc_mr callback 2020-07-06 19:25:53 -03:00
Makefile RDMA/iw_cxgb3: Remove the iw_cxgb3 module from kernel 2019-10-04 15:08:59 -03:00