IB/mlx5: Allow transition of DCI QP to reset
authorMoni Shoua <monis@mellanox.com>
Wed, 12 Sep 2018 06:33:55 +0000 (09:33 +0300)
committerJason Gunthorpe <jgg@mellanox.com>
Wed, 12 Sep 2018 20:58:17 +0000 (14:58 -0600)
The transition is allowed from any state and the atrribute mask must be
IB_QP_STATE.

Fixes: c32a4f296e1d ("IB/mlx5: Add support for DC Initiator QP")
Signed-off-by: Moni Shoua <monis@mellanox.com>
Reviewed-by: Artemy Kovalyov <artemyko@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/hw/mlx5/qp.c

index a2073ee7a16f747dac9e187f268ffe52b00988eb..1f35ecbefffe3e59bfe46f1b61bcc7e995439296 100644 (file)
@@ -3272,7 +3272,9 @@ static bool modify_dci_qp_is_ok(enum ib_qp_state cur_state, enum ib_qp_state new
        int req = IB_QP_STATE;
        int opt = 0;
 
-       if (cur_state == IB_QPS_RESET && new_state == IB_QPS_INIT) {
+       if (new_state == IB_QPS_RESET) {
+               return is_valid_mask(attr_mask, req, opt);
+       } else if (cur_state == IB_QPS_RESET && new_state == IB_QPS_INIT) {
                req |= IB_QP_PKEY_INDEX | IB_QP_PORT;
                return is_valid_mask(attr_mask, req, opt);
        } else if (cur_state == IB_QPS_INIT && new_state == IB_QPS_INIT) {