CC: [email protected] CC: [email protected] CC: [email protected] TO: Aharon Landau <[email protected]> CC: Jason Gunthorpe <[email protected]> CC: Maor Gottlieb <[email protected]> CC: Leon Romanovsky <[email protected]>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: d999ade1cc86cd2951d41c11ea769cb4452c8811 commit: 2fe8d4b87802dcde7fa015229c84bb726f631b4d RDMA/mlx5: Fail QP creation if the device can not support the CQE TS date: 8 months ago :::::: branch date: 27 hours ago :::::: commit date: 8 months ago config: x86_64-randconfig-c007-20211014 (attached as .config) compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 6c76d0101193aa4eb891a6954ff047eda2f9cf71) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=2fe8d4b87802dcde7fa015229c84bb726f631b4d git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git git fetch --no-tags linus master git checkout 2fe8d4b87802dcde7fa015229c84bb726f631b4d # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 clang-analyzer If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <[email protected]> clang-analyzer warnings: (new ones prefixed by >>) include/linux/kernel.h:694:61: note: expanded from macro 'container_of' BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ ^ drivers/infiniband/hw/qib/qib_verbs.c:1666:8: note: Taking false branch tx = list_entry(l, struct qib_verbs_txreq, txreq.list); ^ include/linux/list.h:511:2: note: expanded from macro 'list_entry' container_of(ptr, type, member) ^ include/linux/kernel.h:694:2: note: expanded from macro 'container_of' BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ ^ include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG' #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) ^ include/linux/compiler_types.h:320:2: note: expanded from macro 'compiletime_assert' _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) ^ include/linux/compiler_types.h:308:2: note: expanded from macro '_compiletime_assert' __compiletime_assert(condition, msg, prefix, suffix) ^ include/linux/compiler_types.h:300:3: note: expanded from macro '__compiletime_assert' if (!(condition)) \ ^ drivers/infiniband/hw/qib/qib_verbs.c:1666:8: note: Loop condition is false. Exiting loop tx = list_entry(l, struct qib_verbs_txreq, txreq.list); ^ include/linux/list.h:511:2: note: expanded from macro 'list_entry' container_of(ptr, type, member) ^ include/linux/kernel.h:694:2: note: expanded from macro 'container_of' BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ ^ include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG' #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) ^ include/linux/compiler_types.h:320:2: note: expanded from macro 'compiletime_assert' _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) ^ include/linux/compiler_types.h:308:2: note: expanded from macro '_compiletime_assert' __compiletime_assert(condition, msg, prefix, suffix) ^ include/linux/compiler_types.h:298:2: note: expanded from macro '__compiletime_assert' do { \ ^ drivers/infiniband/hw/qib/qib_verbs.c:1667:3: note: Memory is released kfree(tx); ^~~~~~~~~ drivers/infiniband/hw/qib/qib_verbs.c:1661:2: note: Loop condition is true. Entering loop body while (!list_empty(&dev->txreq_free)) { ^ drivers/infiniband/hw/qib/qib_verbs.c:1665:3: note: Use of memory after it is freed list_del(l); ^ ~ Suppressed 5 warnings (5 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 4 warnings generated. Suppressed 4 warnings (4 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 4 warnings generated. Suppressed 4 warnings (4 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 4 warnings generated. Suppressed 4 warnings (4 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 4 warnings generated. Suppressed 4 warnings (4 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 6 warnings generated. drivers/infiniband/hw/mlx5/main.c:1189:22: warning: Value stored to 'dev' during its initialization is never read [clang-analyzer-deadcode.DeadStores] struct mlx5_ib_dev *dev = to_mdev(ibdev); ^~~ ~~~~~~~~~~~~~~ drivers/infiniband/hw/mlx5/main.c:1189:22: note: Value stored to 'dev' during its initialization is never read struct mlx5_ib_dev *dev = to_mdev(ibdev); ^~~ ~~~~~~~~~~~~~~ drivers/infiniband/hw/mlx5/main.c:1587:6: warning: Value stored to 'ref_bfregs' during its initialization is never read [clang-analyzer-deadcode.DeadStores] int ref_bfregs = req->total_num_bfregs; ^~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~ drivers/infiniband/hw/mlx5/main.c:1587:6: note: Value stored to 'ref_bfregs' during its initialization is never read int ref_bfregs = req->total_num_bfregs; ^~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~ Suppressed 4 warnings (4 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 4 warnings generated. Suppressed 4 warnings (4 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 5 warnings generated. drivers/infiniband/hw/mlx5/mr.c:2375:3: warning: Value stored to 'sg' is never read [clang-analyzer-deadcode.DeadStores] sg = meta_sgl; ^ ~~~~~~~~ drivers/infiniband/hw/mlx5/mr.c:2375:3: note: Value stored to 'sg' is never read sg = meta_sgl; ^ ~~~~~~~~ Suppressed 4 warnings (4 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 9 warnings generated. drivers/infiniband/hw/mlx5/qp.c:1672:2: warning: Value stored to 'hfso' is never read [clang-analyzer-deadcode.DeadStores] hfso = MLX5_ADDR_OF(tirc, tirc, rx_hash_field_selector_outer); ^ drivers/infiniband/hw/mlx5/qp.c:1672:2: note: Value stored to 'hfso' is never read >> drivers/infiniband/hw/mlx5/qp.c:2081:3: warning: Assigned value is garbage >> or undefined [clang-analyzer-core.uninitialized.Assign] MLX5_SET(qpc, qpc, ts_format, ts_format); ^ include/linux/mlx5/device.h:74:2: note: expanded from macro 'MLX5_SET' u32 _v = v; \ ^ ~ drivers/infiniband/hw/mlx5/qp.c:1987:2: note: 'ts_format' declared without an initial value int ts_format; ^~~~~~~~~~~~~ drivers/infiniband/hw/mlx5/qp.c:1993:2: note: Loop condition is false. Exiting loop spin_lock_init(&qp->sq.lock); ^ include/linux/spinlock.h:334:35: note: expanded from macro 'spin_lock_init' # define spin_lock_init(lock) \ ^ drivers/infiniband/hw/mlx5/qp.c:1994:2: note: Loop condition is false. Exiting loop spin_lock_init(&qp->rq.lock); ^ include/linux/spinlock.h:334:35: note: expanded from macro 'spin_lock_init' # define spin_lock_init(lock) \ ^ drivers/infiniband/hw/mlx5/qp.c:1997:6: note: 'mlx5_st' is >= 0 if (mlx5_st < 0) ^~~~~~~ drivers/infiniband/hw/mlx5/qp.c:1997:2: note: Taking false branch if (mlx5_st < 0) ^ drivers/infiniband/hw/mlx5/qp.c:2000:6: note: Assuming field 'sq_sig_type' is not equal to IB_SIGNAL_ALL_WR if (init_attr->sq_sig_type == IB_SIGNAL_ALL_WR) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/infiniband/hw/mlx5/qp.c:2000:2: note: Taking false branch if (init_attr->sq_sig_type == IB_SIGNAL_ALL_WR) ^ drivers/infiniband/hw/mlx5/qp.c:2003:6: note: Assuming the condition is false if (qp->flags & IB_QP_CREATE_SOURCE_QPN) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/infiniband/hw/mlx5/qp.c:2003:2: note: Taking false branch if (qp->flags & IB_QP_CREATE_SOURCE_QPN) ^ drivers/infiniband/hw/mlx5/qp.c:2006:10: note: Assuming field 'qp_type' is not equal to IB_QPT_RAW_PACKET base = (init_attr->qp_type == IB_QPT_RAW_PACKET || ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/infiniband/hw/mlx5/qp.c:2006:10: note: Left side of '||' is false drivers/infiniband/hw/mlx5/qp.c:2006:9: note: '?' condition is false base = (init_attr->qp_type == IB_QPT_RAW_PACKET || ^ drivers/infiniband/hw/mlx5/qp.c:2013:6: note: Assuming 'err' is 0 if (err) { ^~~ drivers/infiniband/hw/mlx5/qp.c:2013:2: note: Taking false branch if (err) { ^ drivers/infiniband/hw/mlx5/qp.c:2018:6: note: Assuming field 'rq_wqe_shift' is equal to field 'wqe_shift' if (ucmd->rq_wqe_shift != qp->rq.wqe_shift || ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/infiniband/hw/mlx5/qp.c:2018:6: note: Left side of '||' is false drivers/infiniband/hw/mlx5/qp.c:2019:6: note: Assuming field 'rq_wqe_count' is equal to field 'wqe_cnt' ucmd->rq_wqe_count != qp->rq.wqe_cnt) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/infiniband/hw/mlx5/qp.c:2018:2: note: Taking false branch if (ucmd->rq_wqe_shift != qp->rq.wqe_shift || ^ drivers/infiniband/hw/mlx5/qp.c:2022:33: note: '?' condition is false if (ucmd->sq_wqe_count > (1 << MLX5_CAP_GEN(mdev, log_max_qp_sz))) ^ include/linux/mlx5/device.h:1198:2: note: expanded from macro 'MLX5_CAP_GEN' MLX5_GET(cmd_hca_cap, mdev->caps.hca_cur[MLX5_CAP_GENERAL], cap) ^ include/linux/mlx5/device.h:95:33: note: expanded from macro 'MLX5_GET' #define MLX5_GET(typ, p, fld) ((be32_to_cpu(*((__be32 *)(p) +\ ^ include/linux/byteorder/generic.h:95:21: note: expanded from macro 'be32_to_cpu' #define be32_to_cpu __be32_to_cpu ^ include/uapi/linux/byteorder/little_endian.h:40:26: note: expanded from macro '__be32_to_cpu' #define __be32_to_cpu(x) __swab32((__force __u32)(__be32)(x)) ^ include/uapi/linux/swab.h:118:3: note: expanded from macro '__swab32' (__builtin_constant_p((__u32)(x)) ? \ ^ drivers/infiniband/hw/mlx5/qp.c:2022:6: note: Assuming the condition is false if (ucmd->sq_wqe_count > (1 << MLX5_CAP_GEN(mdev, log_max_qp_sz))) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/infiniband/hw/mlx5/qp.c:2022:2: note: Taking false branch if (ucmd->sq_wqe_count > (1 << MLX5_CAP_GEN(mdev, log_max_qp_sz))) ^ drivers/infiniband/hw/mlx5/qp.c:2025:6: note: Assuming field 'qp_type' is equal to IB_QPT_RAW_PACKET if (init_attr->qp_type != IB_QPT_RAW_PACKET) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/infiniband/hw/mlx5/qp.c:2025:2: note: Taking false branch if (init_attr->qp_type != IB_QPT_RAW_PACKET) { ^ drivers/infiniband/hw/mlx5/qp.c:2034:6: note: Assuming 'err' is 0 if (err) ^~~ drivers/infiniband/hw/mlx5/qp.c:2034:2: note: Taking false branch if (err) ^ drivers/infiniband/hw/mlx5/qp.c:2037:2: note: Taking false branch if (is_sqp(init_attr->qp_type)) ^ vim +2081 drivers/infiniband/hw/mlx5/qp.c 04bcc1c2d0d7bf Leon Romanovsky 2020-04-27 1970 98fc1126c41614 Leon Romanovsky 2020-04-27 1971 static int create_user_qp(struct mlx5_ib_dev *dev, struct ib_pd *pd, f78d358cec9088 Leon Romanovsky 2020-04-27 1972 struct mlx5_ib_qp *qp, f78d358cec9088 Leon Romanovsky 2020-04-27 1973 struct mlx5_create_qp_params *params) e126ba97dba9ed Eli Cohen 2013-07-07 1974 { f78d358cec9088 Leon Romanovsky 2020-04-27 1975 struct ib_qp_init_attr *init_attr = params->attr; f78d358cec9088 Leon Romanovsky 2020-04-27 1976 struct mlx5_ib_create_qp *ucmd = params->ucmd; 3e09a427ae7ac3 Leon Romanovsky 2020-05-26 1977 u32 out[MLX5_ST_SZ_DW(create_qp_out)] = {}; f78d358cec9088 Leon Romanovsky 2020-04-27 1978 struct ib_udata *udata = params->udata; f78d358cec9088 Leon Romanovsky 2020-04-27 1979 u32 uidx = params->uidx; e126ba97dba9ed Eli Cohen 2013-07-07 1980 struct mlx5_ib_resources *devr = &dev->devr; 09a7d9eca1a6cf Saeed Mahameed 2016-07-19 1981 int inlen = MLX5_ST_SZ_BYTES(create_qp_in); 938fe83c8dcbbf Saeed Mahameed 2015-05-28 1982 struct mlx5_core_dev *mdev = dev->mdev; 89ea94a7b6c40e Maor Gottlieb 2016-06-17 1983 struct mlx5_ib_cq *send_cq; 89ea94a7b6c40e Maor Gottlieb 2016-06-17 1984 struct mlx5_ib_cq *recv_cq; 89ea94a7b6c40e Maor Gottlieb 2016-06-17 1985 unsigned long flags; 09a7d9eca1a6cf Saeed Mahameed 2016-07-19 1986 struct mlx5_ib_qp_base *base; 2fe8d4b87802dc Aharon Landau 2021-02-09 1987 int ts_format; e7b169f34403be Noa Osherovich 2018-02-25 1988 int mlx5_st; cfb5e088e26ae0 Haggai Abramovsky 2016-01-14 1989 void *qpc; 09a7d9eca1a6cf Saeed Mahameed 2016-07-19 1990 u32 *in; 09a7d9eca1a6cf Saeed Mahameed 2016-07-19 1991 int err; e126ba97dba9ed Eli Cohen 2013-07-07 1992 e126ba97dba9ed Eli Cohen 2013-07-07 1993 spin_lock_init(&qp->sq.lock); e126ba97dba9ed Eli Cohen 2013-07-07 1994 spin_lock_init(&qp->rq.lock); e126ba97dba9ed Eli Cohen 2013-07-07 1995 7aede1a25f4b84 Leon Romanovsky 2020-04-27 1996 mlx5_st = to_mlx5_st(qp->type); e7b169f34403be Noa Osherovich 2018-02-25 1997 if (mlx5_st < 0) e7b169f34403be Noa Osherovich 2018-02-25 1998 return -EINVAL; e7b169f34403be Noa Osherovich 2018-02-25 1999 e126ba97dba9ed Eli Cohen 2013-07-07 2000 if (init_attr->sq_sig_type == IB_SIGNAL_ALL_WR) e126ba97dba9ed Eli Cohen 2013-07-07 2001 qp->sq_signal_bits = MLX5_WQE_CTRL_CQ_UPDATE; e126ba97dba9ed Eli Cohen 2013-07-07 2002 2978975ce7f161 Leon Romanovsky 2020-04-27 2003 if (qp->flags & IB_QP_CREATE_SOURCE_QPN) 2978975ce7f161 Leon Romanovsky 2020-04-27 2004 qp->underlay_qpn = init_attr->source_qpn; 2978975ce7f161 Leon Romanovsky 2020-04-27 2005 c2e53b2ce1ba35 Yishai Hadas 2017-06-08 2006 base = (init_attr->qp_type == IB_QPT_RAW_PACKET || 2be08c308f102e Leon Romanovsky 2020-04-27 2007 qp->flags & IB_QP_CREATE_SOURCE_QPN) ? c2e53b2ce1ba35 Yishai Hadas 2017-06-08 2008 &qp->raw_packet_qp.rq.base : c2e53b2ce1ba35 Yishai Hadas 2017-06-08 2009 &qp->trans_qp.base; c2e53b2ce1ba35 Yishai Hadas 2017-06-08 2010 e126ba97dba9ed Eli Cohen 2013-07-07 2011 qp->has_rq = qp_has_rq(init_attr); 2dfac92dbb5d6e Leon Romanovsky 2020-04-27 2012 err = set_rq_size(dev, &init_attr->cap, qp->has_rq, qp, ucmd); e126ba97dba9ed Eli Cohen 2013-07-07 2013 if (err) { e126ba97dba9ed Eli Cohen 2013-07-07 2014 mlx5_ib_dbg(dev, "err %d\n", err); e126ba97dba9ed Eli Cohen 2013-07-07 2015 return err; e126ba97dba9ed Eli Cohen 2013-07-07 2016 } e126ba97dba9ed Eli Cohen 2013-07-07 2017 2dfac92dbb5d6e Leon Romanovsky 2020-04-27 2018 if (ucmd->rq_wqe_shift != qp->rq.wqe_shift || 98fc1126c41614 Leon Romanovsky 2020-04-27 2019 ucmd->rq_wqe_count != qp->rq.wqe_cnt) e126ba97dba9ed Eli Cohen 2013-07-07 2020 return -EINVAL; 98fc1126c41614 Leon Romanovsky 2020-04-27 2021 98fc1126c41614 Leon Romanovsky 2020-04-27 2022 if (ucmd->sq_wqe_count > (1 << MLX5_CAP_GEN(mdev, log_max_qp_sz))) e126ba97dba9ed Eli Cohen 2013-07-07 2023 return -EINVAL; e126ba97dba9ed Eli Cohen 2013-07-07 2024 2fe8d4b87802dc Aharon Landau 2021-02-09 2025 if (init_attr->qp_type != IB_QPT_RAW_PACKET) { 2fe8d4b87802dc Aharon Landau 2021-02-09 2026 ts_format = get_qp_ts_format(dev, to_mcq(init_attr->send_cq), 2fe8d4b87802dc Aharon Landau 2021-02-09 2027 to_mcq(init_attr->recv_cq)); 2fe8d4b87802dc Aharon Landau 2021-02-09 2028 if (ts_format < 0) 2fe8d4b87802dc Aharon Landau 2021-02-09 2029 return ts_format; 2fe8d4b87802dc Aharon Landau 2021-02-09 2030 } 2fe8d4b87802dc Aharon Landau 2021-02-09 2031 08d53976609aec Leon Romanovsky 2020-04-27 2032 err = _create_user_qp(dev, pd, qp, udata, init_attr, &in, ¶ms->resp, 08d53976609aec Leon Romanovsky 2020-04-27 2033 &inlen, base, ucmd); e126ba97dba9ed Eli Cohen 2013-07-07 2034 if (err) e126ba97dba9ed Eli Cohen 2013-07-07 2035 return err; e126ba97dba9ed Eli Cohen 2013-07-07 2036 e126ba97dba9ed Eli Cohen 2013-07-07 2037 if (is_sqp(init_attr->qp_type)) e126ba97dba9ed Eli Cohen 2013-07-07 2038 qp->port = init_attr->port_num; e126ba97dba9ed Eli Cohen 2013-07-07 2039 e383085c242558 Leon Romanovsky 2020-05-26 2040 if (MLX5_CAP_GEN(mdev, ece_support)) e383085c242558 Leon Romanovsky 2020-05-26 2041 MLX5_SET(create_qp_in, in, ece, ucmd->ece_options); 09a7d9eca1a6cf Saeed Mahameed 2016-07-19 2042 qpc = MLX5_ADDR_OF(create_qp_in, in, qpc); 09a7d9eca1a6cf Saeed Mahameed 2016-07-19 2043 e7b169f34403be Noa Osherovich 2018-02-25 2044 MLX5_SET(qpc, qpc, st, mlx5_st); 09a7d9eca1a6cf Saeed Mahameed 2016-07-19 2045 MLX5_SET(qpc, qpc, pm_state, MLX5_QP_PM_MIGRATED); 98fc1126c41614 Leon Romanovsky 2020-04-27 2046 MLX5_SET(qpc, qpc, pd, to_mpd(pd)->pdn); e126ba97dba9ed Eli Cohen 2013-07-07 2047 c95e6d53970254 Leon Romanovsky 2020-04-27 2048 if (qp->flags_en & MLX5_QP_FLAG_SIGNATURE) 09a7d9eca1a6cf Saeed Mahameed 2016-07-19 2049 MLX5_SET(qpc, qpc, wq_signature, 1); e126ba97dba9ed Eli Cohen 2013-07-07 2050 2be08c308f102e Leon Romanovsky 2020-04-27 2051 if (qp->flags & IB_QP_CREATE_BLOCK_MULTICAST_LOOPBACK) 09a7d9eca1a6cf Saeed Mahameed 2016-07-19 2052 MLX5_SET(qpc, qpc, block_lb_mc, 1); f360d88a2efddf Eli Cohen 2014-04-02 2053 2be08c308f102e Leon Romanovsky 2020-04-27 2054 if (qp->flags & IB_QP_CREATE_CROSS_CHANNEL) 09a7d9eca1a6cf Saeed Mahameed 2016-07-19 2055 MLX5_SET(qpc, qpc, cd_master, 1); 2be08c308f102e Leon Romanovsky 2020-04-27 2056 if (qp->flags & IB_QP_CREATE_MANAGED_SEND) 09a7d9eca1a6cf Saeed Mahameed 2016-07-19 2057 MLX5_SET(qpc, qpc, cd_slave_send, 1); 2be08c308f102e Leon Romanovsky 2020-04-27 2058 if (qp->flags & IB_QP_CREATE_MANAGED_RECV) 09a7d9eca1a6cf Saeed Mahameed 2016-07-19 2059 MLX5_SET(qpc, qpc, cd_slave_receive, 1); 2be08c308f102e Leon Romanovsky 2020-04-27 2060 if (qp->flags_en & MLX5_QP_FLAG_PACKET_BASED_CREDIT_MODE) 569c665150156e Danit Goldberg 2018-11-30 2061 MLX5_SET(qpc, qpc, req_e2e_credit_mode, 1); 90ecb37a751b69 Leon Romanovsky 2020-04-27 2062 if ((qp->flags_en & MLX5_QP_FLAG_SCATTER_CQE) && 90ecb37a751b69 Leon Romanovsky 2020-04-27 2063 (init_attr->qp_type == IB_QPT_RC || 8bde2c509e4035 Leon Romanovsky 2020-04-27 2064 init_attr->qp_type == IB_QPT_UC)) { 52c81f47f0d268 Colin Ian King 2020-05-07 2065 int rcqe_sz = mlx5_ib_get_cqe_size(init_attr->recv_cq); 8bde2c509e4035 Leon Romanovsky 2020-04-27 2066 8bde2c509e4035 Leon Romanovsky 2020-04-27 2067 MLX5_SET(qpc, qpc, cs_res, 8bde2c509e4035 Leon Romanovsky 2020-04-27 2068 rcqe_sz == 128 ? MLX5_RES_SCAT_DATA64_CQE : 8bde2c509e4035 Leon Romanovsky 2020-04-27 2069 MLX5_RES_SCAT_DATA32_CQE); 8bde2c509e4035 Leon Romanovsky 2020-04-27 2070 } 90ecb37a751b69 Leon Romanovsky 2020-04-27 2071 if ((qp->flags_en & MLX5_QP_FLAG_SCATTER_CQE) && 7aede1a25f4b84 Leon Romanovsky 2020-04-27 2072 (qp->type == MLX5_IB_QPT_DCI || qp->type == IB_QPT_RC)) 81530ab08ef002 Leon Romanovsky 2020-07-28 2073 configure_requester_scat_cqe(dev, qp, init_attr, qpc); e126ba97dba9ed Eli Cohen 2013-07-07 2074 e126ba97dba9ed Eli Cohen 2013-07-07 2075 if (qp->rq.wqe_cnt) { 09a7d9eca1a6cf Saeed Mahameed 2016-07-19 2076 MLX5_SET(qpc, qpc, log_rq_stride, qp->rq.wqe_shift - 4); 09a7d9eca1a6cf Saeed Mahameed 2016-07-19 2077 MLX5_SET(qpc, qpc, log_rq_size, ilog2(qp->rq.wqe_cnt)); e126ba97dba9ed Eli Cohen 2013-07-07 2078 } e126ba97dba9ed Eli Cohen 2013-07-07 2079 2fe8d4b87802dc Aharon Landau 2021-02-09 2080 if (init_attr->qp_type != IB_QPT_RAW_PACKET) 2fe8d4b87802dc Aharon Landau 2021-02-09 @2081 MLX5_SET(qpc, qpc, ts_format, ts_format); 2fe8d4b87802dc Aharon Landau 2021-02-09 2082 09a7d9eca1a6cf Saeed Mahameed 2016-07-19 2083 MLX5_SET(qpc, qpc, rq_type, get_rx_type(qp, init_attr)); e126ba97dba9ed Eli Cohen 2013-07-07 2084 3fd3307ef34fc9 Artemy Kovalyov 2017-08-17 2085 if (qp->sq.wqe_cnt) { 09a7d9eca1a6cf Saeed Mahameed 2016-07-19 2086 MLX5_SET(qpc, qpc, log_sq_size, ilog2(qp->sq.wqe_cnt)); 3fd3307ef34fc9 Artemy Kovalyov 2017-08-17 2087 } else { 09a7d9eca1a6cf Saeed Mahameed 2016-07-19 2088 MLX5_SET(qpc, qpc, no_sq, 1); 3fd3307ef34fc9 Artemy Kovalyov 2017-08-17 2089 if (init_attr->srq && 3fd3307ef34fc9 Artemy Kovalyov 2017-08-17 2090 init_attr->srq->srq_type == IB_SRQT_TM) 3fd3307ef34fc9 Artemy Kovalyov 2017-08-17 2091 MLX5_SET(qpc, qpc, offload_type, 3fd3307ef34fc9 Artemy Kovalyov 2017-08-17 2092 MLX5_QPC_OFFLOAD_TYPE_RNDV); 3fd3307ef34fc9 Artemy Kovalyov 2017-08-17 2093 } e126ba97dba9ed Eli Cohen 2013-07-07 2094 e126ba97dba9ed Eli Cohen 2013-07-07 2095 /* Set default resources */ e126ba97dba9ed Eli Cohen 2013-07-07 2096 switch (init_attr->qp_type) { e126ba97dba9ed Eli Cohen 2013-07-07 2097 case IB_QPT_XRC_INI: 09a7d9eca1a6cf Saeed Mahameed 2016-07-19 2098 MLX5_SET(qpc, qpc, cqn_rcv, to_mcq(devr->c0)->mcq.cqn); f4375443b7861c Leon Romanovsky 2020-07-06 2099 MLX5_SET(qpc, qpc, xrcd, devr->xrcdn1); 09a7d9eca1a6cf Saeed Mahameed 2016-07-19 2100 MLX5_SET(qpc, qpc, srqn_rmpn_xrqn, to_msrq(devr->s0)->msrq.srqn); e126ba97dba9ed Eli Cohen 2013-07-07 2101 break; e126ba97dba9ed Eli Cohen 2013-07-07 2102 default: e126ba97dba9ed Eli Cohen 2013-07-07 2103 if (init_attr->srq) { f4375443b7861c Leon Romanovsky 2020-07-06 2104 MLX5_SET(qpc, qpc, xrcd, devr->xrcdn0); 09a7d9eca1a6cf Saeed Mahameed 2016-07-19 2105 MLX5_SET(qpc, qpc, srqn_rmpn_xrqn, to_msrq(init_attr->srq)->msrq.srqn); e126ba97dba9ed Eli Cohen 2013-07-07 2106 } else { f4375443b7861c Leon Romanovsky 2020-07-06 2107 MLX5_SET(qpc, qpc, xrcd, devr->xrcdn1); 09a7d9eca1a6cf Saeed Mahameed 2016-07-19 2108 MLX5_SET(qpc, qpc, srqn_rmpn_xrqn, to_msrq(devr->s1)->msrq.srqn); e126ba97dba9ed Eli Cohen 2013-07-07 2109 } e126ba97dba9ed Eli Cohen 2013-07-07 2110 } e126ba97dba9ed Eli Cohen 2013-07-07 2111 e126ba97dba9ed Eli Cohen 2013-07-07 2112 if (init_attr->send_cq) 09a7d9eca1a6cf Saeed Mahameed 2016-07-19 2113 MLX5_SET(qpc, qpc, cqn_snd, to_mcq(init_attr->send_cq)->mcq.cqn); e126ba97dba9ed Eli Cohen 2013-07-07 2114 e126ba97dba9ed Eli Cohen 2013-07-07 2115 if (init_attr->recv_cq) 09a7d9eca1a6cf Saeed Mahameed 2016-07-19 2116 MLX5_SET(qpc, qpc, cqn_rcv, to_mcq(init_attr->recv_cq)->mcq.cqn); e126ba97dba9ed Eli Cohen 2013-07-07 2117 09a7d9eca1a6cf Saeed Mahameed 2016-07-19 2118 MLX5_SET64(qpc, qpc, dbr_addr, qp->db.dma); e126ba97dba9ed Eli Cohen 2013-07-07 2119 cfb5e088e26ae0 Haggai Abramovsky 2016-01-14 2120 /* 0xffffff means we ask to work with cqe version 0 */ 09a7d9eca1a6cf Saeed Mahameed 2016-07-19 2121 if (MLX5_CAP_GEN(mdev, cqe_version) == MLX5_CQE_VERSION_V1) cfb5e088e26ae0 Haggai Abramovsky 2016-01-14 2122 MLX5_SET(qpc, qpc, user_index, uidx); 09a7d9eca1a6cf Saeed Mahameed 2016-07-19 2123 2978975ce7f161 Leon Romanovsky 2020-04-27 2124 if (qp->flags & IB_QP_CREATE_PCI_WRITE_END_PADDING && 2978975ce7f161 Leon Romanovsky 2020-04-27 2125 init_attr->qp_type != IB_QPT_RAW_PACKET) { b1383aa6412177 Noa Osherovich 2017-10-29 2126 MLX5_SET(qpc, qpc, end_padding_mode, b1383aa6412177 Noa Osherovich 2017-10-29 2127 MLX5_WQ_END_PAD_MODE_ALIGN); 2978975ce7f161 Leon Romanovsky 2020-04-27 2128 /* Special case to clean flag */ 2978975ce7f161 Leon Romanovsky 2020-04-27 2129 qp->flags &= ~IB_QP_CREATE_PCI_WRITE_END_PADDING; b1383aa6412177 Noa Osherovich 2017-10-29 2130 } b1383aa6412177 Noa Osherovich 2017-10-29 2131 c2e53b2ce1ba35 Yishai Hadas 2017-06-08 2132 if (init_attr->qp_type == IB_QPT_RAW_PACKET || 2be08c308f102e Leon Romanovsky 2020-04-27 2133 qp->flags & IB_QP_CREATE_SOURCE_QPN) { 2dfac92dbb5d6e Leon Romanovsky 2020-04-27 2134 qp->raw_packet_qp.sq.ubuffer.buf_addr = ucmd->sq_buf_addr; 0fb2ed66a14c8c [email protected] 2016-01-14 2135 raw_packet_qp_copy_info(qp, &qp->raw_packet_qp); 7f72052cb48efb Yishai Hadas 2018-09-20 2136 err = create_raw_packet_qp(dev, qp, in, inlen, pd, udata, 2fe8d4b87802dc Aharon Landau 2021-02-09 2137 ¶ms->resp, init_attr); 04bcc1c2d0d7bf Leon Romanovsky 2020-04-27 2138 } else 3e09a427ae7ac3 Leon Romanovsky 2020-05-26 2139 err = mlx5_qpc_create_qp(dev, &base->mqp, in, inlen, out); e126ba97dba9ed Eli Cohen 2013-07-07 2140 479163f4608214 Al Viro 2014-11-20 2141 kvfree(in); 04bcc1c2d0d7bf Leon Romanovsky 2020-04-27 2142 if (err) 04bcc1c2d0d7bf Leon Romanovsky 2020-04-27 2143 goto err_create; e126ba97dba9ed Eli Cohen 2013-07-07 2144 19098df2da784c [email protected] 2016-01-14 2145 base->container_mibqp = qp; 19098df2da784c [email protected] 2016-01-14 2146 base->mqp.event = mlx5_ib_qp_event; 92cd667c0e8a67 Leon Romanovsky 2020-06-02 2147 if (MLX5_CAP_GEN(mdev, ece_support)) 3e09a427ae7ac3 Leon Romanovsky 2020-05-26 2148 params->resp.ece_options = MLX5_GET(create_qp_out, out, ece); e126ba97dba9ed Eli Cohen 2013-07-07 2149 7aede1a25f4b84 Leon Romanovsky 2020-04-27 2150 get_cqs(qp->type, init_attr->send_cq, init_attr->recv_cq, 89ea94a7b6c40e Maor Gottlieb 2016-06-17 2151 &send_cq, &recv_cq); 89ea94a7b6c40e Maor Gottlieb 2016-06-17 2152 spin_lock_irqsave(&dev->reset_flow_resource_lock, flags); 89ea94a7b6c40e Maor Gottlieb 2016-06-17 2153 mlx5_ib_lock_cqs(send_cq, recv_cq); 89ea94a7b6c40e Maor Gottlieb 2016-06-17 2154 /* Maintain device to QPs access, needed for further handling via reset 89ea94a7b6c40e Maor Gottlieb 2016-06-17 2155 * flow 89ea94a7b6c40e Maor Gottlieb 2016-06-17 2156 */ 89ea94a7b6c40e Maor Gottlieb 2016-06-17 2157 list_add_tail(&qp->qps_list, &dev->qp_list); 89ea94a7b6c40e Maor Gottlieb 2016-06-17 2158 /* Maintain CQ to QPs access, needed for further handling via reset flow 89ea94a7b6c40e Maor Gottlieb 2016-06-17 2159 */ 89ea94a7b6c40e Maor Gottlieb 2016-06-17 2160 if (send_cq) 89ea94a7b6c40e Maor Gottlieb 2016-06-17 2161 list_add_tail(&qp->cq_send_list, &send_cq->list_send_qp); 89ea94a7b6c40e Maor Gottlieb 2016-06-17 2162 if (recv_cq) 89ea94a7b6c40e Maor Gottlieb 2016-06-17 2163 list_add_tail(&qp->cq_recv_list, &recv_cq->list_recv_qp); 89ea94a7b6c40e Maor Gottlieb 2016-06-17 2164 mlx5_ib_unlock_cqs(send_cq, recv_cq); 89ea94a7b6c40e Maor Gottlieb 2016-06-17 2165 spin_unlock_irqrestore(&dev->reset_flow_resource_lock, flags); 89ea94a7b6c40e Maor Gottlieb 2016-06-17 2166 e126ba97dba9ed Eli Cohen 2013-07-07 2167 return 0; e126ba97dba9ed Eli Cohen 2013-07-07 2168 e126ba97dba9ed Eli Cohen 2013-07-07 2169 err_create: 747c519cdbe4a3 Leon Romanovsky 2020-04-27 2170 destroy_qp(dev, qp, base, udata); e126ba97dba9ed Eli Cohen 2013-07-07 2171 return err; e126ba97dba9ed Eli Cohen 2013-07-07 2172 } e126ba97dba9ed Eli Cohen 2013-07-07 2173 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/[email protected]
.config.gz
Description: application/gzip
_______________________________________________ kbuild mailing list -- [email protected] To unsubscribe send an email to [email protected]
