Hi Jiapeng, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on rdma/for-next] [also build test WARNING on v5.14-rc2 next-20210723] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Jiapeng-Chong/RDMA-irdma-Fix-missing-error-code-in-irdma_modify_qp_roce/20210723-183422 base: https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git for-next config: x86_64-allyesconfig (attached as .config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0 reproduce (this is a W=1 build): # https://github.com/0day-ci/linux/commit/c4d5794806c724fafed155d5d1186fc7cecba055 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Jiapeng-Chong/RDMA-irdma-Fix-missing-error-code-in-irdma_modify_qp_roce/20210723-183422 git checkout c4d5794806c724fafed155d5d1186fc7cecba055 # save the attached .config to linux build tree make W=1 ARCH=x86_64 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@xxxxxxxxx> All warnings (new ones prefixed by >>): drivers/infiniband/hw/irdma/verbs.c: In function 'irdma_modify_qp_roce': >> drivers/infiniband/hw/irdma/verbs.c:1345:4: warning: this 'if' clause does not guard... [-Wmisleading-indentation] 1345 | if (iwqp->iwarp_state == IRDMA_QP_STATE_SQD) | ^~ drivers/infiniband/hw/irdma/verbs.c:1347:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if' 1347 | goto exit; | ^~~~ vim +/if +1345 drivers/infiniband/hw/irdma/verbs.c b48c24c2d710cf Mustafa Ismail 2021-06-02 1106 b48c24c2d710cf Mustafa Ismail 2021-06-02 1107 /** b48c24c2d710cf Mustafa Ismail 2021-06-02 1108 * irdma_modify_qp_roce - modify qp request b48c24c2d710cf Mustafa Ismail 2021-06-02 1109 * @ibqp: qp's pointer for modify b48c24c2d710cf Mustafa Ismail 2021-06-02 1110 * @attr: access attributes b48c24c2d710cf Mustafa Ismail 2021-06-02 1111 * @attr_mask: state mask b48c24c2d710cf Mustafa Ismail 2021-06-02 1112 * @udata: user data b48c24c2d710cf Mustafa Ismail 2021-06-02 1113 */ b48c24c2d710cf Mustafa Ismail 2021-06-02 1114 int irdma_modify_qp_roce(struct ib_qp *ibqp, struct ib_qp_attr *attr, b48c24c2d710cf Mustafa Ismail 2021-06-02 1115 int attr_mask, struct ib_udata *udata) b48c24c2d710cf Mustafa Ismail 2021-06-02 1116 { b48c24c2d710cf Mustafa Ismail 2021-06-02 1117 struct irdma_pd *iwpd = to_iwpd(ibqp->pd); b48c24c2d710cf Mustafa Ismail 2021-06-02 1118 struct irdma_qp *iwqp = to_iwqp(ibqp); b48c24c2d710cf Mustafa Ismail 2021-06-02 1119 struct irdma_device *iwdev = iwqp->iwdev; b48c24c2d710cf Mustafa Ismail 2021-06-02 1120 struct irdma_sc_dev *dev = &iwdev->rf->sc_dev; b48c24c2d710cf Mustafa Ismail 2021-06-02 1121 struct irdma_qp_host_ctx_info *ctx_info; b48c24c2d710cf Mustafa Ismail 2021-06-02 1122 struct irdma_roce_offload_info *roce_info; b48c24c2d710cf Mustafa Ismail 2021-06-02 1123 struct irdma_udp_offload_info *udp_info; b48c24c2d710cf Mustafa Ismail 2021-06-02 1124 struct irdma_modify_qp_info info = {}; b48c24c2d710cf Mustafa Ismail 2021-06-02 1125 struct irdma_modify_qp_resp uresp = {}; b48c24c2d710cf Mustafa Ismail 2021-06-02 1126 struct irdma_modify_qp_req ureq = {}; b48c24c2d710cf Mustafa Ismail 2021-06-02 1127 unsigned long flags; b48c24c2d710cf Mustafa Ismail 2021-06-02 1128 u8 issue_modify_qp = 0; b48c24c2d710cf Mustafa Ismail 2021-06-02 1129 int ret = 0; b48c24c2d710cf Mustafa Ismail 2021-06-02 1130 b48c24c2d710cf Mustafa Ismail 2021-06-02 1131 ctx_info = &iwqp->ctx_info; b48c24c2d710cf Mustafa Ismail 2021-06-02 1132 roce_info = &iwqp->roce_info; b48c24c2d710cf Mustafa Ismail 2021-06-02 1133 udp_info = &iwqp->udp_info; b48c24c2d710cf Mustafa Ismail 2021-06-02 1134 b48c24c2d710cf Mustafa Ismail 2021-06-02 1135 if (attr_mask & ~IB_QP_ATTR_STANDARD_BITS) b48c24c2d710cf Mustafa Ismail 2021-06-02 1136 return -EOPNOTSUPP; b48c24c2d710cf Mustafa Ismail 2021-06-02 1137 b48c24c2d710cf Mustafa Ismail 2021-06-02 1138 if (attr_mask & IB_QP_DEST_QPN) b48c24c2d710cf Mustafa Ismail 2021-06-02 1139 roce_info->dest_qp = attr->dest_qp_num; b48c24c2d710cf Mustafa Ismail 2021-06-02 1140 b48c24c2d710cf Mustafa Ismail 2021-06-02 1141 if (attr_mask & IB_QP_PKEY_INDEX) { b48c24c2d710cf Mustafa Ismail 2021-06-02 1142 ret = irdma_query_pkey(ibqp->device, 0, attr->pkey_index, b48c24c2d710cf Mustafa Ismail 2021-06-02 1143 &roce_info->p_key); b48c24c2d710cf Mustafa Ismail 2021-06-02 1144 if (ret) b48c24c2d710cf Mustafa Ismail 2021-06-02 1145 return ret; b48c24c2d710cf Mustafa Ismail 2021-06-02 1146 } b48c24c2d710cf Mustafa Ismail 2021-06-02 1147 b48c24c2d710cf Mustafa Ismail 2021-06-02 1148 if (attr_mask & IB_QP_QKEY) b48c24c2d710cf Mustafa Ismail 2021-06-02 1149 roce_info->qkey = attr->qkey; b48c24c2d710cf Mustafa Ismail 2021-06-02 1150 b48c24c2d710cf Mustafa Ismail 2021-06-02 1151 if (attr_mask & IB_QP_PATH_MTU) b48c24c2d710cf Mustafa Ismail 2021-06-02 1152 udp_info->snd_mss = ib_mtu_enum_to_int(attr->path_mtu); b48c24c2d710cf Mustafa Ismail 2021-06-02 1153 b48c24c2d710cf Mustafa Ismail 2021-06-02 1154 if (attr_mask & IB_QP_SQ_PSN) { b48c24c2d710cf Mustafa Ismail 2021-06-02 1155 udp_info->psn_nxt = attr->sq_psn; b48c24c2d710cf Mustafa Ismail 2021-06-02 1156 udp_info->lsn = 0xffff; b48c24c2d710cf Mustafa Ismail 2021-06-02 1157 udp_info->psn_una = attr->sq_psn; b48c24c2d710cf Mustafa Ismail 2021-06-02 1158 udp_info->psn_max = attr->sq_psn; b48c24c2d710cf Mustafa Ismail 2021-06-02 1159 } b48c24c2d710cf Mustafa Ismail 2021-06-02 1160 b48c24c2d710cf Mustafa Ismail 2021-06-02 1161 if (attr_mask & IB_QP_RQ_PSN) b48c24c2d710cf Mustafa Ismail 2021-06-02 1162 udp_info->epsn = attr->rq_psn; b48c24c2d710cf Mustafa Ismail 2021-06-02 1163 b48c24c2d710cf Mustafa Ismail 2021-06-02 1164 if (attr_mask & IB_QP_RNR_RETRY) b48c24c2d710cf Mustafa Ismail 2021-06-02 1165 udp_info->rnr_nak_thresh = attr->rnr_retry; b48c24c2d710cf Mustafa Ismail 2021-06-02 1166 b48c24c2d710cf Mustafa Ismail 2021-06-02 1167 if (attr_mask & IB_QP_RETRY_CNT) b48c24c2d710cf Mustafa Ismail 2021-06-02 1168 udp_info->rexmit_thresh = attr->retry_cnt; b48c24c2d710cf Mustafa Ismail 2021-06-02 1169 b48c24c2d710cf Mustafa Ismail 2021-06-02 1170 ctx_info->roce_info->pd_id = iwpd->sc_pd.pd_id; b48c24c2d710cf Mustafa Ismail 2021-06-02 1171 b48c24c2d710cf Mustafa Ismail 2021-06-02 1172 if (attr_mask & IB_QP_AV) { b48c24c2d710cf Mustafa Ismail 2021-06-02 1173 struct irdma_av *av = &iwqp->roce_ah.av; b48c24c2d710cf Mustafa Ismail 2021-06-02 1174 const struct ib_gid_attr *sgid_attr; b48c24c2d710cf Mustafa Ismail 2021-06-02 1175 u16 vlan_id = VLAN_N_VID; b48c24c2d710cf Mustafa Ismail 2021-06-02 1176 u32 local_ip[4]; b48c24c2d710cf Mustafa Ismail 2021-06-02 1177 b48c24c2d710cf Mustafa Ismail 2021-06-02 1178 memset(&iwqp->roce_ah, 0, sizeof(iwqp->roce_ah)); b48c24c2d710cf Mustafa Ismail 2021-06-02 1179 if (attr->ah_attr.ah_flags & IB_AH_GRH) { b48c24c2d710cf Mustafa Ismail 2021-06-02 1180 udp_info->ttl = attr->ah_attr.grh.hop_limit; b48c24c2d710cf Mustafa Ismail 2021-06-02 1181 udp_info->flow_label = attr->ah_attr.grh.flow_label; b48c24c2d710cf Mustafa Ismail 2021-06-02 1182 udp_info->tos = attr->ah_attr.grh.traffic_class; b48c24c2d710cf Mustafa Ismail 2021-06-02 1183 irdma_qp_rem_qos(&iwqp->sc_qp); b48c24c2d710cf Mustafa Ismail 2021-06-02 1184 dev->ws_remove(iwqp->sc_qp.vsi, ctx_info->user_pri); b48c24c2d710cf Mustafa Ismail 2021-06-02 1185 ctx_info->user_pri = rt_tos2priority(udp_info->tos); b48c24c2d710cf Mustafa Ismail 2021-06-02 1186 iwqp->sc_qp.user_pri = ctx_info->user_pri; b48c24c2d710cf Mustafa Ismail 2021-06-02 1187 if (dev->ws_add(iwqp->sc_qp.vsi, ctx_info->user_pri)) b48c24c2d710cf Mustafa Ismail 2021-06-02 1188 return -ENOMEM; b48c24c2d710cf Mustafa Ismail 2021-06-02 1189 irdma_qp_add_qos(&iwqp->sc_qp); b48c24c2d710cf Mustafa Ismail 2021-06-02 1190 } b48c24c2d710cf Mustafa Ismail 2021-06-02 1191 sgid_attr = attr->ah_attr.grh.sgid_attr; b48c24c2d710cf Mustafa Ismail 2021-06-02 1192 ret = rdma_read_gid_l2_fields(sgid_attr, &vlan_id, b48c24c2d710cf Mustafa Ismail 2021-06-02 1193 ctx_info->roce_info->mac_addr); b48c24c2d710cf Mustafa Ismail 2021-06-02 1194 if (ret) b48c24c2d710cf Mustafa Ismail 2021-06-02 1195 return ret; b48c24c2d710cf Mustafa Ismail 2021-06-02 1196 b48c24c2d710cf Mustafa Ismail 2021-06-02 1197 if (vlan_id >= VLAN_N_VID && iwdev->dcb) b48c24c2d710cf Mustafa Ismail 2021-06-02 1198 vlan_id = 0; b48c24c2d710cf Mustafa Ismail 2021-06-02 1199 if (vlan_id < VLAN_N_VID) { b48c24c2d710cf Mustafa Ismail 2021-06-02 1200 udp_info->insert_vlan_tag = true; b48c24c2d710cf Mustafa Ismail 2021-06-02 1201 udp_info->vlan_tag = vlan_id | b48c24c2d710cf Mustafa Ismail 2021-06-02 1202 ctx_info->user_pri << VLAN_PRIO_SHIFT; b48c24c2d710cf Mustafa Ismail 2021-06-02 1203 } else { b48c24c2d710cf Mustafa Ismail 2021-06-02 1204 udp_info->insert_vlan_tag = false; b48c24c2d710cf Mustafa Ismail 2021-06-02 1205 } b48c24c2d710cf Mustafa Ismail 2021-06-02 1206 b48c24c2d710cf Mustafa Ismail 2021-06-02 1207 av->attrs = attr->ah_attr; b48c24c2d710cf Mustafa Ismail 2021-06-02 1208 rdma_gid2ip((struct sockaddr *)&av->sgid_addr, &sgid_attr->gid); b48c24c2d710cf Mustafa Ismail 2021-06-02 1209 rdma_gid2ip((struct sockaddr *)&av->dgid_addr, &attr->ah_attr.grh.dgid); b48c24c2d710cf Mustafa Ismail 2021-06-02 1210 roce_info->local_qp = ibqp->qp_num; b48c24c2d710cf Mustafa Ismail 2021-06-02 1211 if (av->sgid_addr.saddr.sa_family == AF_INET6) { b48c24c2d710cf Mustafa Ismail 2021-06-02 1212 __be32 *daddr = b48c24c2d710cf Mustafa Ismail 2021-06-02 1213 av->dgid_addr.saddr_in6.sin6_addr.in6_u.u6_addr32; b48c24c2d710cf Mustafa Ismail 2021-06-02 1214 __be32 *saddr = b48c24c2d710cf Mustafa Ismail 2021-06-02 1215 av->sgid_addr.saddr_in6.sin6_addr.in6_u.u6_addr32; b48c24c2d710cf Mustafa Ismail 2021-06-02 1216 b48c24c2d710cf Mustafa Ismail 2021-06-02 1217 irdma_copy_ip_ntohl(&udp_info->dest_ip_addr[0], daddr); b48c24c2d710cf Mustafa Ismail 2021-06-02 1218 irdma_copy_ip_ntohl(&udp_info->local_ipaddr[0], saddr); b48c24c2d710cf Mustafa Ismail 2021-06-02 1219 b48c24c2d710cf Mustafa Ismail 2021-06-02 1220 udp_info->ipv4 = false; b48c24c2d710cf Mustafa Ismail 2021-06-02 1221 irdma_copy_ip_ntohl(local_ip, daddr); b48c24c2d710cf Mustafa Ismail 2021-06-02 1222 b48c24c2d710cf Mustafa Ismail 2021-06-02 1223 udp_info->arp_idx = irdma_arp_table(iwdev->rf, b48c24c2d710cf Mustafa Ismail 2021-06-02 1224 &local_ip[0], b48c24c2d710cf Mustafa Ismail 2021-06-02 1225 false, NULL, b48c24c2d710cf Mustafa Ismail 2021-06-02 1226 IRDMA_ARP_RESOLVE); b48c24c2d710cf Mustafa Ismail 2021-06-02 1227 } else { b48c24c2d710cf Mustafa Ismail 2021-06-02 1228 __be32 saddr = av->sgid_addr.saddr_in.sin_addr.s_addr; b48c24c2d710cf Mustafa Ismail 2021-06-02 1229 __be32 daddr = av->dgid_addr.saddr_in.sin_addr.s_addr; b48c24c2d710cf Mustafa Ismail 2021-06-02 1230 b48c24c2d710cf Mustafa Ismail 2021-06-02 1231 local_ip[0] = ntohl(daddr); b48c24c2d710cf Mustafa Ismail 2021-06-02 1232 b48c24c2d710cf Mustafa Ismail 2021-06-02 1233 udp_info->ipv4 = true; b48c24c2d710cf Mustafa Ismail 2021-06-02 1234 udp_info->dest_ip_addr[0] = 0; b48c24c2d710cf Mustafa Ismail 2021-06-02 1235 udp_info->dest_ip_addr[1] = 0; b48c24c2d710cf Mustafa Ismail 2021-06-02 1236 udp_info->dest_ip_addr[2] = 0; b48c24c2d710cf Mustafa Ismail 2021-06-02 1237 udp_info->dest_ip_addr[3] = local_ip[0]; b48c24c2d710cf Mustafa Ismail 2021-06-02 1238 b48c24c2d710cf Mustafa Ismail 2021-06-02 1239 udp_info->local_ipaddr[0] = 0; b48c24c2d710cf Mustafa Ismail 2021-06-02 1240 udp_info->local_ipaddr[1] = 0; b48c24c2d710cf Mustafa Ismail 2021-06-02 1241 udp_info->local_ipaddr[2] = 0; b48c24c2d710cf Mustafa Ismail 2021-06-02 1242 udp_info->local_ipaddr[3] = ntohl(saddr); b48c24c2d710cf Mustafa Ismail 2021-06-02 1243 } b48c24c2d710cf Mustafa Ismail 2021-06-02 1244 udp_info->arp_idx = b48c24c2d710cf Mustafa Ismail 2021-06-02 1245 irdma_add_arp(iwdev->rf, local_ip, udp_info->ipv4, b48c24c2d710cf Mustafa Ismail 2021-06-02 1246 attr->ah_attr.roce.dmac); b48c24c2d710cf Mustafa Ismail 2021-06-02 1247 } b48c24c2d710cf Mustafa Ismail 2021-06-02 1248 b48c24c2d710cf Mustafa Ismail 2021-06-02 1249 if (attr_mask & IB_QP_MAX_QP_RD_ATOMIC) { b48c24c2d710cf Mustafa Ismail 2021-06-02 1250 if (attr->max_rd_atomic > dev->hw_attrs.max_hw_ord) { b48c24c2d710cf Mustafa Ismail 2021-06-02 1251 ibdev_err(&iwdev->ibdev, b48c24c2d710cf Mustafa Ismail 2021-06-02 1252 "rd_atomic = %d, above max_hw_ord=%d\n", b48c24c2d710cf Mustafa Ismail 2021-06-02 1253 attr->max_rd_atomic, b48c24c2d710cf Mustafa Ismail 2021-06-02 1254 dev->hw_attrs.max_hw_ord); b48c24c2d710cf Mustafa Ismail 2021-06-02 1255 return -EINVAL; b48c24c2d710cf Mustafa Ismail 2021-06-02 1256 } b48c24c2d710cf Mustafa Ismail 2021-06-02 1257 if (attr->max_rd_atomic) b48c24c2d710cf Mustafa Ismail 2021-06-02 1258 roce_info->ord_size = attr->max_rd_atomic; b48c24c2d710cf Mustafa Ismail 2021-06-02 1259 info.ord_valid = true; b48c24c2d710cf Mustafa Ismail 2021-06-02 1260 } b48c24c2d710cf Mustafa Ismail 2021-06-02 1261 b48c24c2d710cf Mustafa Ismail 2021-06-02 1262 if (attr_mask & IB_QP_MAX_DEST_RD_ATOMIC) { b48c24c2d710cf Mustafa Ismail 2021-06-02 1263 if (attr->max_dest_rd_atomic > dev->hw_attrs.max_hw_ird) { b48c24c2d710cf Mustafa Ismail 2021-06-02 1264 ibdev_err(&iwdev->ibdev, b48c24c2d710cf Mustafa Ismail 2021-06-02 1265 "rd_atomic = %d, above max_hw_ird=%d\n", b48c24c2d710cf Mustafa Ismail 2021-06-02 1266 attr->max_rd_atomic, b48c24c2d710cf Mustafa Ismail 2021-06-02 1267 dev->hw_attrs.max_hw_ird); b48c24c2d710cf Mustafa Ismail 2021-06-02 1268 return -EINVAL; b48c24c2d710cf Mustafa Ismail 2021-06-02 1269 } b48c24c2d710cf Mustafa Ismail 2021-06-02 1270 if (attr->max_dest_rd_atomic) b48c24c2d710cf Mustafa Ismail 2021-06-02 1271 roce_info->ird_size = attr->max_dest_rd_atomic; b48c24c2d710cf Mustafa Ismail 2021-06-02 1272 } b48c24c2d710cf Mustafa Ismail 2021-06-02 1273 b48c24c2d710cf Mustafa Ismail 2021-06-02 1274 if (attr_mask & IB_QP_ACCESS_FLAGS) { b48c24c2d710cf Mustafa Ismail 2021-06-02 1275 if (attr->qp_access_flags & IB_ACCESS_LOCAL_WRITE) b48c24c2d710cf Mustafa Ismail 2021-06-02 1276 roce_info->wr_rdresp_en = true; b48c24c2d710cf Mustafa Ismail 2021-06-02 1277 if (attr->qp_access_flags & IB_ACCESS_REMOTE_WRITE) b48c24c2d710cf Mustafa Ismail 2021-06-02 1278 roce_info->wr_rdresp_en = true; b48c24c2d710cf Mustafa Ismail 2021-06-02 1279 if (attr->qp_access_flags & IB_ACCESS_REMOTE_READ) b48c24c2d710cf Mustafa Ismail 2021-06-02 1280 roce_info->rd_en = true; b48c24c2d710cf Mustafa Ismail 2021-06-02 1281 } b48c24c2d710cf Mustafa Ismail 2021-06-02 1282 b48c24c2d710cf Mustafa Ismail 2021-06-02 1283 wait_event(iwqp->mod_qp_waitq, !atomic_read(&iwqp->hw_mod_qp_pend)); b48c24c2d710cf Mustafa Ismail 2021-06-02 1284 b48c24c2d710cf Mustafa Ismail 2021-06-02 1285 ibdev_dbg(&iwdev->ibdev, b48c24c2d710cf Mustafa Ismail 2021-06-02 1286 "VERBS: caller: %pS qp_id=%d to_ibqpstate=%d ibqpstate=%d irdma_qpstate=%d attr_mask=0x%x\n", b48c24c2d710cf Mustafa Ismail 2021-06-02 1287 __builtin_return_address(0), ibqp->qp_num, attr->qp_state, b48c24c2d710cf Mustafa Ismail 2021-06-02 1288 iwqp->ibqp_state, iwqp->iwarp_state, attr_mask); b48c24c2d710cf Mustafa Ismail 2021-06-02 1289 b48c24c2d710cf Mustafa Ismail 2021-06-02 1290 spin_lock_irqsave(&iwqp->lock, flags); b48c24c2d710cf Mustafa Ismail 2021-06-02 1291 if (attr_mask & IB_QP_STATE) { b48c24c2d710cf Mustafa Ismail 2021-06-02 1292 if (!ib_modify_qp_is_ok(iwqp->ibqp_state, attr->qp_state, b48c24c2d710cf Mustafa Ismail 2021-06-02 1293 iwqp->ibqp.qp_type, attr_mask)) { b48c24c2d710cf Mustafa Ismail 2021-06-02 1294 ibdev_warn(&iwdev->ibdev, "modify_qp invalid for qp_id=%d, old_state=0x%x, new_state=0x%x\n", b48c24c2d710cf Mustafa Ismail 2021-06-02 1295 iwqp->ibqp.qp_num, iwqp->ibqp_state, b48c24c2d710cf Mustafa Ismail 2021-06-02 1296 attr->qp_state); b48c24c2d710cf Mustafa Ismail 2021-06-02 1297 ret = -EINVAL; b48c24c2d710cf Mustafa Ismail 2021-06-02 1298 goto exit; b48c24c2d710cf Mustafa Ismail 2021-06-02 1299 } b48c24c2d710cf Mustafa Ismail 2021-06-02 1300 info.curr_iwarp_state = iwqp->iwarp_state; b48c24c2d710cf Mustafa Ismail 2021-06-02 1301 b48c24c2d710cf Mustafa Ismail 2021-06-02 1302 switch (attr->qp_state) { b48c24c2d710cf Mustafa Ismail 2021-06-02 1303 case IB_QPS_INIT: b48c24c2d710cf Mustafa Ismail 2021-06-02 1304 if (iwqp->iwarp_state > IRDMA_QP_STATE_IDLE) { b48c24c2d710cf Mustafa Ismail 2021-06-02 1305 ret = -EINVAL; b48c24c2d710cf Mustafa Ismail 2021-06-02 1306 goto exit; b48c24c2d710cf Mustafa Ismail 2021-06-02 1307 } b48c24c2d710cf Mustafa Ismail 2021-06-02 1308 b48c24c2d710cf Mustafa Ismail 2021-06-02 1309 if (iwqp->iwarp_state == IRDMA_QP_STATE_INVALID) { b48c24c2d710cf Mustafa Ismail 2021-06-02 1310 info.next_iwarp_state = IRDMA_QP_STATE_IDLE; b48c24c2d710cf Mustafa Ismail 2021-06-02 1311 issue_modify_qp = 1; b48c24c2d710cf Mustafa Ismail 2021-06-02 1312 } b48c24c2d710cf Mustafa Ismail 2021-06-02 1313 break; b48c24c2d710cf Mustafa Ismail 2021-06-02 1314 case IB_QPS_RTR: b48c24c2d710cf Mustafa Ismail 2021-06-02 1315 if (iwqp->iwarp_state > IRDMA_QP_STATE_IDLE) { b48c24c2d710cf Mustafa Ismail 2021-06-02 1316 ret = -EINVAL; b48c24c2d710cf Mustafa Ismail 2021-06-02 1317 goto exit; b48c24c2d710cf Mustafa Ismail 2021-06-02 1318 } b48c24c2d710cf Mustafa Ismail 2021-06-02 1319 info.arp_cache_idx_valid = true; b48c24c2d710cf Mustafa Ismail 2021-06-02 1320 info.cq_num_valid = true; b48c24c2d710cf Mustafa Ismail 2021-06-02 1321 info.next_iwarp_state = IRDMA_QP_STATE_RTR; b48c24c2d710cf Mustafa Ismail 2021-06-02 1322 issue_modify_qp = 1; b48c24c2d710cf Mustafa Ismail 2021-06-02 1323 break; b48c24c2d710cf Mustafa Ismail 2021-06-02 1324 case IB_QPS_RTS: b48c24c2d710cf Mustafa Ismail 2021-06-02 1325 if (iwqp->ibqp_state < IB_QPS_RTR || b48c24c2d710cf Mustafa Ismail 2021-06-02 1326 iwqp->ibqp_state == IB_QPS_ERR) { b48c24c2d710cf Mustafa Ismail 2021-06-02 1327 ret = -EINVAL; b48c24c2d710cf Mustafa Ismail 2021-06-02 1328 goto exit; b48c24c2d710cf Mustafa Ismail 2021-06-02 1329 } b48c24c2d710cf Mustafa Ismail 2021-06-02 1330 b48c24c2d710cf Mustafa Ismail 2021-06-02 1331 info.arp_cache_idx_valid = true; b48c24c2d710cf Mustafa Ismail 2021-06-02 1332 info.cq_num_valid = true; b48c24c2d710cf Mustafa Ismail 2021-06-02 1333 info.ord_valid = true; b48c24c2d710cf Mustafa Ismail 2021-06-02 1334 info.next_iwarp_state = IRDMA_QP_STATE_RTS; b48c24c2d710cf Mustafa Ismail 2021-06-02 1335 issue_modify_qp = 1; b48c24c2d710cf Mustafa Ismail 2021-06-02 1336 if (iwdev->push_mode && udata && b48c24c2d710cf Mustafa Ismail 2021-06-02 1337 iwqp->sc_qp.push_idx == IRDMA_INVALID_PUSH_PAGE_INDEX && b48c24c2d710cf Mustafa Ismail 2021-06-02 1338 dev->hw_attrs.uk_attrs.hw_rev >= IRDMA_GEN_2) { b48c24c2d710cf Mustafa Ismail 2021-06-02 1339 spin_unlock_irqrestore(&iwqp->lock, flags); b48c24c2d710cf Mustafa Ismail 2021-06-02 1340 irdma_alloc_push_page(iwqp); b48c24c2d710cf Mustafa Ismail 2021-06-02 1341 spin_lock_irqsave(&iwqp->lock, flags); b48c24c2d710cf Mustafa Ismail 2021-06-02 1342 } b48c24c2d710cf Mustafa Ismail 2021-06-02 1343 break; b48c24c2d710cf Mustafa Ismail 2021-06-02 1344 case IB_QPS_SQD: b48c24c2d710cf Mustafa Ismail 2021-06-02 @1345 if (iwqp->iwarp_state == IRDMA_QP_STATE_SQD) c4d5794806c724 chongjiapeng 2021-07-23 1346 ret = -EINVAL; b48c24c2d710cf Mustafa Ismail 2021-06-02 1347 goto exit; b48c24c2d710cf Mustafa Ismail 2021-06-02 1348 b48c24c2d710cf Mustafa Ismail 2021-06-02 1349 if (iwqp->iwarp_state != IRDMA_QP_STATE_RTS) { b48c24c2d710cf Mustafa Ismail 2021-06-02 1350 ret = -EINVAL; b48c24c2d710cf Mustafa Ismail 2021-06-02 1351 goto exit; b48c24c2d710cf Mustafa Ismail 2021-06-02 1352 } b48c24c2d710cf Mustafa Ismail 2021-06-02 1353 b48c24c2d710cf Mustafa Ismail 2021-06-02 1354 info.next_iwarp_state = IRDMA_QP_STATE_SQD; b48c24c2d710cf Mustafa Ismail 2021-06-02 1355 issue_modify_qp = 1; b48c24c2d710cf Mustafa Ismail 2021-06-02 1356 break; b48c24c2d710cf Mustafa Ismail 2021-06-02 1357 case IB_QPS_SQE: b48c24c2d710cf Mustafa Ismail 2021-06-02 1358 case IB_QPS_ERR: b48c24c2d710cf Mustafa Ismail 2021-06-02 1359 case IB_QPS_RESET: b48c24c2d710cf Mustafa Ismail 2021-06-02 1360 if (iwqp->iwarp_state == IRDMA_QP_STATE_RTS) { b48c24c2d710cf Mustafa Ismail 2021-06-02 1361 spin_unlock_irqrestore(&iwqp->lock, flags); b48c24c2d710cf Mustafa Ismail 2021-06-02 1362 info.next_iwarp_state = IRDMA_QP_STATE_SQD; b48c24c2d710cf Mustafa Ismail 2021-06-02 1363 irdma_hw_modify_qp(iwdev, iwqp, &info, true); b48c24c2d710cf Mustafa Ismail 2021-06-02 1364 spin_lock_irqsave(&iwqp->lock, flags); b48c24c2d710cf Mustafa Ismail 2021-06-02 1365 } b48c24c2d710cf Mustafa Ismail 2021-06-02 1366 b48c24c2d710cf Mustafa Ismail 2021-06-02 1367 if (iwqp->iwarp_state == IRDMA_QP_STATE_ERROR) { b48c24c2d710cf Mustafa Ismail 2021-06-02 1368 spin_unlock_irqrestore(&iwqp->lock, flags); b48c24c2d710cf Mustafa Ismail 2021-06-02 1369 if (udata) { b48c24c2d710cf Mustafa Ismail 2021-06-02 1370 if (ib_copy_from_udata(&ureq, udata, b48c24c2d710cf Mustafa Ismail 2021-06-02 1371 min(sizeof(ureq), udata->inlen))) b48c24c2d710cf Mustafa Ismail 2021-06-02 1372 return -EINVAL; b48c24c2d710cf Mustafa Ismail 2021-06-02 1373 b48c24c2d710cf Mustafa Ismail 2021-06-02 1374 irdma_flush_wqes(iwqp, b48c24c2d710cf Mustafa Ismail 2021-06-02 1375 (ureq.sq_flush ? IRDMA_FLUSH_SQ : 0) | b48c24c2d710cf Mustafa Ismail 2021-06-02 1376 (ureq.rq_flush ? IRDMA_FLUSH_RQ : 0) | b48c24c2d710cf Mustafa Ismail 2021-06-02 1377 IRDMA_REFLUSH); b48c24c2d710cf Mustafa Ismail 2021-06-02 1378 } b48c24c2d710cf Mustafa Ismail 2021-06-02 1379 return 0; b48c24c2d710cf Mustafa Ismail 2021-06-02 1380 } b48c24c2d710cf Mustafa Ismail 2021-06-02 1381 b48c24c2d710cf Mustafa Ismail 2021-06-02 1382 info.next_iwarp_state = IRDMA_QP_STATE_ERROR; b48c24c2d710cf Mustafa Ismail 2021-06-02 1383 issue_modify_qp = 1; b48c24c2d710cf Mustafa Ismail 2021-06-02 1384 break; b48c24c2d710cf Mustafa Ismail 2021-06-02 1385 default: b48c24c2d710cf Mustafa Ismail 2021-06-02 1386 ret = -EINVAL; b48c24c2d710cf Mustafa Ismail 2021-06-02 1387 goto exit; b48c24c2d710cf Mustafa Ismail 2021-06-02 1388 } b48c24c2d710cf Mustafa Ismail 2021-06-02 1389 b48c24c2d710cf Mustafa Ismail 2021-06-02 1390 iwqp->ibqp_state = attr->qp_state; b48c24c2d710cf Mustafa Ismail 2021-06-02 1391 } b48c24c2d710cf Mustafa Ismail 2021-06-02 1392 b48c24c2d710cf Mustafa Ismail 2021-06-02 1393 ctx_info->send_cq_num = iwqp->iwscq->sc_cq.cq_uk.cq_id; b48c24c2d710cf Mustafa Ismail 2021-06-02 1394 ctx_info->rcv_cq_num = iwqp->iwrcq->sc_cq.cq_uk.cq_id; b48c24c2d710cf Mustafa Ismail 2021-06-02 1395 irdma_sc_qp_setctx_roce(&iwqp->sc_qp, iwqp->host_ctx.va, ctx_info); b48c24c2d710cf Mustafa Ismail 2021-06-02 1396 spin_unlock_irqrestore(&iwqp->lock, flags); b48c24c2d710cf Mustafa Ismail 2021-06-02 1397 b48c24c2d710cf Mustafa Ismail 2021-06-02 1398 if (attr_mask & IB_QP_STATE) { b48c24c2d710cf Mustafa Ismail 2021-06-02 1399 if (issue_modify_qp) { b48c24c2d710cf Mustafa Ismail 2021-06-02 1400 ctx_info->rem_endpoint_idx = udp_info->arp_idx; b48c24c2d710cf Mustafa Ismail 2021-06-02 1401 if (irdma_hw_modify_qp(iwdev, iwqp, &info, true)) b48c24c2d710cf Mustafa Ismail 2021-06-02 1402 return -EINVAL; b48c24c2d710cf Mustafa Ismail 2021-06-02 1403 spin_lock_irqsave(&iwqp->lock, flags); b48c24c2d710cf Mustafa Ismail 2021-06-02 1404 if (iwqp->iwarp_state == info.curr_iwarp_state) { b48c24c2d710cf Mustafa Ismail 2021-06-02 1405 iwqp->iwarp_state = info.next_iwarp_state; b48c24c2d710cf Mustafa Ismail 2021-06-02 1406 iwqp->ibqp_state = attr->qp_state; b48c24c2d710cf Mustafa Ismail 2021-06-02 1407 } b48c24c2d710cf Mustafa Ismail 2021-06-02 1408 if (iwqp->ibqp_state > IB_QPS_RTS && b48c24c2d710cf Mustafa Ismail 2021-06-02 1409 !iwqp->flush_issued) { b48c24c2d710cf Mustafa Ismail 2021-06-02 1410 iwqp->flush_issued = 1; b48c24c2d710cf Mustafa Ismail 2021-06-02 1411 spin_unlock_irqrestore(&iwqp->lock, flags); b48c24c2d710cf Mustafa Ismail 2021-06-02 1412 irdma_flush_wqes(iwqp, IRDMA_FLUSH_SQ | b48c24c2d710cf Mustafa Ismail 2021-06-02 1413 IRDMA_FLUSH_RQ | b48c24c2d710cf Mustafa Ismail 2021-06-02 1414 IRDMA_FLUSH_WAIT); b48c24c2d710cf Mustafa Ismail 2021-06-02 1415 } else { b48c24c2d710cf Mustafa Ismail 2021-06-02 1416 spin_unlock_irqrestore(&iwqp->lock, flags); b48c24c2d710cf Mustafa Ismail 2021-06-02 1417 } b48c24c2d710cf Mustafa Ismail 2021-06-02 1418 } else { b48c24c2d710cf Mustafa Ismail 2021-06-02 1419 iwqp->ibqp_state = attr->qp_state; b48c24c2d710cf Mustafa Ismail 2021-06-02 1420 } b48c24c2d710cf Mustafa Ismail 2021-06-02 1421 if (udata && dev->hw_attrs.uk_attrs.hw_rev >= IRDMA_GEN_2) { b48c24c2d710cf Mustafa Ismail 2021-06-02 1422 struct irdma_ucontext *ucontext; b48c24c2d710cf Mustafa Ismail 2021-06-02 1423 b48c24c2d710cf Mustafa Ismail 2021-06-02 1424 ucontext = rdma_udata_to_drv_context(udata, b48c24c2d710cf Mustafa Ismail 2021-06-02 1425 struct irdma_ucontext, ibucontext); b48c24c2d710cf Mustafa Ismail 2021-06-02 1426 if (iwqp->sc_qp.push_idx != IRDMA_INVALID_PUSH_PAGE_INDEX && b48c24c2d710cf Mustafa Ismail 2021-06-02 1427 !iwqp->push_wqe_mmap_entry && b48c24c2d710cf Mustafa Ismail 2021-06-02 1428 !irdma_setup_push_mmap_entries(ucontext, iwqp, b48c24c2d710cf Mustafa Ismail 2021-06-02 1429 &uresp.push_wqe_mmap_key, &uresp.push_db_mmap_key)) { b48c24c2d710cf Mustafa Ismail 2021-06-02 1430 uresp.push_valid = 1; b48c24c2d710cf Mustafa Ismail 2021-06-02 1431 uresp.push_offset = iwqp->sc_qp.push_offset; b48c24c2d710cf Mustafa Ismail 2021-06-02 1432 } b48c24c2d710cf Mustafa Ismail 2021-06-02 1433 ret = ib_copy_to_udata(udata, &uresp, min(sizeof(uresp), b48c24c2d710cf Mustafa Ismail 2021-06-02 1434 udata->outlen)); b48c24c2d710cf Mustafa Ismail 2021-06-02 1435 if (ret) { b48c24c2d710cf Mustafa Ismail 2021-06-02 1436 irdma_remove_push_mmap_entries(iwqp); b48c24c2d710cf Mustafa Ismail 2021-06-02 1437 ibdev_dbg(&iwdev->ibdev, b48c24c2d710cf Mustafa Ismail 2021-06-02 1438 "VERBS: copy_to_udata failed\n"); b48c24c2d710cf Mustafa Ismail 2021-06-02 1439 return ret; b48c24c2d710cf Mustafa Ismail 2021-06-02 1440 } b48c24c2d710cf Mustafa Ismail 2021-06-02 1441 } b48c24c2d710cf Mustafa Ismail 2021-06-02 1442 } b48c24c2d710cf Mustafa Ismail 2021-06-02 1443 b48c24c2d710cf Mustafa Ismail 2021-06-02 1444 return 0; b48c24c2d710cf Mustafa Ismail 2021-06-02 1445 exit: b48c24c2d710cf Mustafa Ismail 2021-06-02 1446 spin_unlock_irqrestore(&iwqp->lock, flags); b48c24c2d710cf Mustafa Ismail 2021-06-02 1447 b48c24c2d710cf Mustafa Ismail 2021-06-02 1448 return ret; b48c24c2d710cf Mustafa Ismail 2021-06-02 1449 } b48c24c2d710cf Mustafa Ismail 2021-06-02 1450 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip