qp.c (3ce60f443b143e649aa26cd3f668d645434647ac) | qp.c (2019d70e919f01c43975b8d9ea2803b890eabba9) |
---|---|
1/* 2 * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved. 3 * 4 * This software is available to you under a choice of one of two 5 * licenses. You may choose to be licensed under the terms of the GNU 6 * General Public License (GPL) Version 2, available from the file 7 * COPYING in the main directory of this source tree, or the 8 * OpenIB.org BSD license below: --- 4217 unchanged lines hidden (view full) --- 4226{ 4227 struct mlx5_ib_dev *dev = to_mdev(ibqp->device); 4228 struct mlx5_ib_modify_qp_resp resp = {}; 4229 struct mlx5_ib_qp *qp = to_mqp(ibqp); 4230 struct mlx5_ib_modify_qp ucmd = {}; 4231 enum ib_qp_type qp_type; 4232 enum ib_qp_state cur_state, new_state; 4233 int err = -EINVAL; | 1/* 2 * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved. 3 * 4 * This software is available to you under a choice of one of two 5 * licenses. You may choose to be licensed under the terms of the GNU 6 * General Public License (GPL) Version 2, available from the file 7 * COPYING in the main directory of this source tree, or the 8 * OpenIB.org BSD license below: --- 4217 unchanged lines hidden (view full) --- 4226{ 4227 struct mlx5_ib_dev *dev = to_mdev(ibqp->device); 4228 struct mlx5_ib_modify_qp_resp resp = {}; 4229 struct mlx5_ib_qp *qp = to_mqp(ibqp); 4230 struct mlx5_ib_modify_qp ucmd = {}; 4231 enum ib_qp_type qp_type; 4232 enum ib_qp_state cur_state, new_state; 4233 int err = -EINVAL; |
4234 int port; | |
4235 4236 if (!mlx5_ib_modify_qp_allowed(dev, qp, ibqp->qp_type)) 4237 return -EOPNOTSUPP; 4238 4239 if (attr_mask & ~(IB_QP_ATTR_STANDARD_BITS | IB_QP_RATE_LIMIT)) 4240 return -EOPNOTSUPP; 4241 4242 if (ibqp->rwq_ind_tbl) --- 28 unchanged lines hidden (view full) --- 4271 if (qp_type == MLX5_IB_QPT_DCT) 4272 return mlx5_ib_modify_dct(ibqp, attr, attr_mask, &ucmd, udata); 4273 4274 mutex_lock(&qp->mutex); 4275 4276 cur_state = attr_mask & IB_QP_CUR_STATE ? attr->cur_qp_state : qp->state; 4277 new_state = attr_mask & IB_QP_STATE ? attr->qp_state : cur_state; 4278 | 4234 4235 if (!mlx5_ib_modify_qp_allowed(dev, qp, ibqp->qp_type)) 4236 return -EOPNOTSUPP; 4237 4238 if (attr_mask & ~(IB_QP_ATTR_STANDARD_BITS | IB_QP_RATE_LIMIT)) 4239 return -EOPNOTSUPP; 4240 4241 if (ibqp->rwq_ind_tbl) --- 28 unchanged lines hidden (view full) --- 4270 if (qp_type == MLX5_IB_QPT_DCT) 4271 return mlx5_ib_modify_dct(ibqp, attr, attr_mask, &ucmd, udata); 4272 4273 mutex_lock(&qp->mutex); 4274 4275 cur_state = attr_mask & IB_QP_CUR_STATE ? attr->cur_qp_state : qp->state; 4276 new_state = attr_mask & IB_QP_STATE ? attr->qp_state : cur_state; 4277 |
4279 if (!(cur_state == new_state && cur_state == IB_QPS_RESET)) { 4280 port = attr_mask & IB_QP_PORT ? attr->port_num : qp->port; 4281 } 4282 | |
4283 if (qp->flags & IB_QP_CREATE_SOURCE_QPN) { 4284 if (attr_mask & ~(IB_QP_STATE | IB_QP_CUR_STATE)) { 4285 mlx5_ib_dbg(dev, "invalid attr_mask 0x%x when underlay QP is used\n", 4286 attr_mask); 4287 goto out; 4288 } 4289 } else if (qp_type != MLX5_IB_QPT_REG_UMR && 4290 qp_type != MLX5_IB_QPT_DCI && --- 12 unchanged lines hidden (view full) --- 4303 if ((attr_mask & IB_QP_PORT) && 4304 (attr->port_num == 0 || 4305 attr->port_num > dev->num_ports)) { 4306 mlx5_ib_dbg(dev, "invalid port number %d. number of ports is %d\n", 4307 attr->port_num, dev->num_ports); 4308 goto out; 4309 } 4310 | 4278 if (qp->flags & IB_QP_CREATE_SOURCE_QPN) { 4279 if (attr_mask & ~(IB_QP_STATE | IB_QP_CUR_STATE)) { 4280 mlx5_ib_dbg(dev, "invalid attr_mask 0x%x when underlay QP is used\n", 4281 attr_mask); 4282 goto out; 4283 } 4284 } else if (qp_type != MLX5_IB_QPT_REG_UMR && 4285 qp_type != MLX5_IB_QPT_DCI && --- 12 unchanged lines hidden (view full) --- 4298 if ((attr_mask & IB_QP_PORT) && 4299 (attr->port_num == 0 || 4300 attr->port_num > dev->num_ports)) { 4301 mlx5_ib_dbg(dev, "invalid port number %d. number of ports is %d\n", 4302 attr->port_num, dev->num_ports); 4303 goto out; 4304 } 4305 |
4311 if (attr_mask & IB_QP_PKEY_INDEX) { 4312 port = attr_mask & IB_QP_PORT ? attr->port_num : qp->port; 4313 if (attr->pkey_index >= 4314 dev->port_caps[port - 1].pkey_table_len) { 4315 mlx5_ib_dbg(dev, "invalid pkey index %d\n", 4316 attr->pkey_index); 4317 goto out; 4318 } | 4306 if ((attr_mask & IB_QP_PKEY_INDEX) && 4307 attr->pkey_index >= dev->pkey_table_len) { 4308 mlx5_ib_dbg(dev, "invalid pkey index %d\n", attr->pkey_index); 4309 goto out; |
4319 } 4320 4321 if (attr_mask & IB_QP_MAX_QP_RD_ATOMIC && 4322 attr->max_rd_atomic > 4323 (1 << MLX5_CAP_GEN(dev->mdev, log_max_ra_res_qp))) { 4324 mlx5_ib_dbg(dev, "invalid max_rd_atomic value %d\n", 4325 attr->max_rd_atomic); 4326 goto out; --- 1101 unchanged lines hidden --- | 4310 } 4311 4312 if (attr_mask & IB_QP_MAX_QP_RD_ATOMIC && 4313 attr->max_rd_atomic > 4314 (1 << MLX5_CAP_GEN(dev->mdev, log_max_ra_res_qp))) { 4315 mlx5_ib_dbg(dev, "invalid max_rd_atomic value %d\n", 4316 attr->max_rd_atomic); 4317 goto out; --- 1101 unchanged lines hidden --- |