OSDN Git Service

IB/mlx5: Add support for drain SQ & RQ
authorYishai Hadas <yishaih@mellanox.com>
Tue, 19 Jun 2018 07:43:55 +0000 (10:43 +0300)
committerJason Gunthorpe <jgg@mellanox.com>
Mon, 25 Jun 2018 20:32:36 +0000 (14:32 -0600)
commitd0e84c0ad39826c38a9d6881fd8f9af476a5d9a7
treec7876f29f0e148f1d9df27bbfc4b4dba82b2b1d6
parentea8c2d8f6014b74921dd5a9654a623a725d79608
IB/mlx5: Add support for drain SQ & RQ

This patch follows the logic from ib_core but considers the internal
device state upon executing the involved commands.

Specifically,
Upon internal error state modify QP to an error state can be assumed to
be success as each in-progress WR going to be flushed in error in any
case as expected by that modify command.

In addition,
As the drain should never fail the driver makes sure that post_send/recv
will succeed even if the device is already in an internal error state.
As such once the driver will supply the simulated/SW CQEs the CQE for
the drain WR will be handled as well.

In case of an internal error state the CQE for the drain WR may be
completed as part of the main task that handled the error state or by
the task that issued the drain WR.

As the above depends on scheduling the code takes the relevant locks and
actions to make sure that the completion handler for that WR will always
be called after that the post_send/recv were issued but not in parallel
to the other task that handles the error flow.

Signed-off-by: Yishai Hadas <yishaih@mellanox.com>
Reviewed-by: Max Gurtovoy <maxg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/hw/mlx5/main.c
drivers/infiniband/hw/mlx5/mlx5_ib.h
drivers/infiniband/hw/mlx5/qp.c