diff options
author | Joachim Fenkes <fenkes@de.ibm.com> | 2007-09-11 09:34:04 -0400 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2007-10-09 22:59:10 -0400 |
commit | e90d0b3daede2bae2e78f8bf88c19182961cd19d (patch) | |
tree | a04090695e126a4f7b12743084679eebb7abf83e /drivers/infiniband/hw/ehca | |
parent | b708fba3c2942a175c3cb04a7bb4c89f907b497b (diff) |
IB/ehca: Path migration support
Fix some modify_qp() issues related to path migration.
Signed-off-by: Joachim Fenkes <fenkes@de.ibm.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/hw/ehca')
-rw-r--r-- | drivers/infiniband/hw/ehca/ehca_irq.c | 4 | ||||
-rw-r--r-- | drivers/infiniband/hw/ehca/ehca_qp.c | 90 |
2 files changed, 68 insertions, 26 deletions
diff --git a/drivers/infiniband/hw/ehca/ehca_irq.c b/drivers/infiniband/hw/ehca/ehca_irq.c index a925ea52443f..70939864fef3 100644 --- a/drivers/infiniband/hw/ehca/ehca_irq.c +++ b/drivers/infiniband/hw/ehca/ehca_irq.c | |||
@@ -294,8 +294,8 @@ static void parse_identifier(struct ehca_shca *shca, u64 eqe) | |||
294 | case 0x11: /* unaffiliated access error */ | 294 | case 0x11: /* unaffiliated access error */ |
295 | ehca_err(&shca->ib_device, "Unaffiliated access error."); | 295 | ehca_err(&shca->ib_device, "Unaffiliated access error."); |
296 | break; | 296 | break; |
297 | case 0x12: /* path migrating error */ | 297 | case 0x12: /* path migrating */ |
298 | ehca_err(&shca->ib_device, "Path migration error."); | 298 | ehca_err(&shca->ib_device, "Path migrating."); |
299 | break; | 299 | break; |
300 | case 0x13: /* interface trace stopped */ | 300 | case 0x13: /* interface trace stopped */ |
301 | ehca_err(&shca->ib_device, "Interface trace stopped."); | 301 | ehca_err(&shca->ib_device, "Interface trace stopped."); |
diff --git a/drivers/infiniband/hw/ehca/ehca_qp.c b/drivers/infiniband/hw/ehca/ehca_qp.c index f95403cb523d..b10c7df669bb 100644 --- a/drivers/infiniband/hw/ehca/ehca_qp.c +++ b/drivers/infiniband/hw/ehca/ehca_qp.c | |||
@@ -1165,6 +1165,13 @@ static int internal_modify_qp(struct ib_qp *ibqp, | |||
1165 | } | 1165 | } |
1166 | 1166 | ||
1167 | if (attr_mask & IB_QP_PKEY_INDEX) { | 1167 | if (attr_mask & IB_QP_PKEY_INDEX) { |
1168 | if (attr->pkey_index >= 16) { | ||
1169 | ret = -EINVAL; | ||
1170 | ehca_err(ibqp->device, "Invalid pkey_index=%x. " | ||
1171 | "ehca_qp=%p qp_num=%x max_pkey_index=f", | ||
1172 | attr->pkey_index, my_qp, ibqp->qp_num); | ||
1173 | goto modify_qp_exit2; | ||
1174 | } | ||
1168 | mqpcb->prim_p_key_idx = attr->pkey_index; | 1175 | mqpcb->prim_p_key_idx = attr->pkey_index; |
1169 | update_mask |= EHCA_BMASK_SET(MQPCB_MASK_PRIM_P_KEY_IDX, 1); | 1176 | update_mask |= EHCA_BMASK_SET(MQPCB_MASK_PRIM_P_KEY_IDX, 1); |
1170 | } | 1177 | } |
@@ -1273,50 +1280,78 @@ static int internal_modify_qp(struct ib_qp *ibqp, | |||
1273 | int ehca_mult = ib_rate_to_mult( | 1280 | int ehca_mult = ib_rate_to_mult( |
1274 | shca->sport[my_qp->init_attr.port_num].rate); | 1281 | shca->sport[my_qp->init_attr.port_num].rate); |
1275 | 1282 | ||
1283 | if (attr->alt_port_num < 1 | ||
1284 | || attr->alt_port_num > shca->num_ports) { | ||
1285 | ret = -EINVAL; | ||
1286 | ehca_err(ibqp->device, "Invalid alt_port=%x. " | ||
1287 | "ehca_qp=%p qp_num=%x num_ports=%x", | ||
1288 | attr->alt_port_num, my_qp, ibqp->qp_num, | ||
1289 | shca->num_ports); | ||
1290 | goto modify_qp_exit2; | ||
1291 | } | ||
1292 | mqpcb->alt_phys_port = attr->alt_port_num; | ||
1293 | |||
1294 | if (attr->alt_pkey_index >= 16) { | ||
1295 | ret = -EINVAL; | ||
1296 | ehca_err(ibqp->device, "Invalid alt_pkey_index=%x. " | ||
1297 | "ehca_qp=%p qp_num=%x max_pkey_index=f", | ||
1298 | attr->pkey_index, my_qp, ibqp->qp_num); | ||
1299 | goto modify_qp_exit2; | ||
1300 | } | ||
1301 | mqpcb->alt_p_key_idx = attr->alt_pkey_index; | ||
1302 | |||
1303 | mqpcb->timeout_al = attr->alt_timeout; | ||
1276 | mqpcb->dlid_al = attr->alt_ah_attr.dlid; | 1304 | mqpcb->dlid_al = attr->alt_ah_attr.dlid; |
1277 | update_mask |= EHCA_BMASK_SET(MQPCB_MASK_DLID_AL, 1); | ||
1278 | mqpcb->source_path_bits_al = attr->alt_ah_attr.src_path_bits; | 1305 | mqpcb->source_path_bits_al = attr->alt_ah_attr.src_path_bits; |
1279 | update_mask |= | ||
1280 | EHCA_BMASK_SET(MQPCB_MASK_SOURCE_PATH_BITS_AL, 1); | ||
1281 | mqpcb->service_level_al = attr->alt_ah_attr.sl; | 1306 | mqpcb->service_level_al = attr->alt_ah_attr.sl; |
1282 | update_mask |= EHCA_BMASK_SET(MQPCB_MASK_SERVICE_LEVEL_AL, 1); | ||
1283 | 1307 | ||
1284 | if (ah_mult < ehca_mult) | 1308 | if (ah_mult > 0 && ah_mult < ehca_mult) |
1285 | mqpcb->max_static_rate = (ah_mult > 0) ? | 1309 | mqpcb->max_static_rate_al = (ehca_mult - 1) / ah_mult; |
1286 | ((ehca_mult - 1) / ah_mult) : 0; | ||
1287 | else | 1310 | else |
1288 | mqpcb->max_static_rate_al = 0; | 1311 | mqpcb->max_static_rate_al = 0; |
1289 | 1312 | ||
1290 | update_mask |= EHCA_BMASK_SET(MQPCB_MASK_MAX_STATIC_RATE_AL, 1); | 1313 | /* OpenIB doesn't support alternate retry counts - copy them */ |
1314 | mqpcb->retry_count_al = mqpcb->retry_count; | ||
1315 | mqpcb->rnr_retry_count_al = mqpcb->rnr_retry_count; | ||
1316 | |||
1317 | update_mask |= EHCA_BMASK_SET(MQPCB_MASK_ALT_PHYS_PORT, 1) | ||
1318 | | EHCA_BMASK_SET(MQPCB_MASK_ALT_P_KEY_IDX, 1) | ||
1319 | | EHCA_BMASK_SET(MQPCB_MASK_TIMEOUT_AL, 1) | ||
1320 | | EHCA_BMASK_SET(MQPCB_MASK_DLID_AL, 1) | ||
1321 | | EHCA_BMASK_SET(MQPCB_MASK_SOURCE_PATH_BITS_AL, 1) | ||
1322 | | EHCA_BMASK_SET(MQPCB_MASK_SERVICE_LEVEL_AL, 1) | ||
1323 | | EHCA_BMASK_SET(MQPCB_MASK_MAX_STATIC_RATE_AL, 1) | ||
1324 | | EHCA_BMASK_SET(MQPCB_MASK_RETRY_COUNT_AL, 1) | ||
1325 | | EHCA_BMASK_SET(MQPCB_MASK_RNR_RETRY_COUNT_AL, 1); | ||
1326 | |||
1327 | /* | ||
1328 | * Always supply the GRH flag, even if it's zero, to give the | ||
1329 | * hypervisor a clear "yes" or "no" instead of a "perhaps" | ||
1330 | */ | ||
1331 | update_mask |= EHCA_BMASK_SET(MQPCB_MASK_SEND_GRH_FLAG_AL, 1); | ||
1291 | 1332 | ||
1292 | /* | 1333 | /* |
1293 | * only if GRH is TRUE we might consider SOURCE_GID_IDX | 1334 | * only if GRH is TRUE we might consider SOURCE_GID_IDX |
1294 | * and DEST_GID otherwise phype will return H_ATTR_PARM!!! | 1335 | * and DEST_GID otherwise phype will return H_ATTR_PARM!!! |
1295 | */ | 1336 | */ |
1296 | if (attr->alt_ah_attr.ah_flags == IB_AH_GRH) { | 1337 | if (attr->alt_ah_attr.ah_flags == IB_AH_GRH) { |
1297 | mqpcb->send_grh_flag_al = 1 << 31; | 1338 | mqpcb->send_grh_flag_al = 1; |
1298 | update_mask |= | ||
1299 | EHCA_BMASK_SET(MQPCB_MASK_SEND_GRH_FLAG_AL, 1); | ||
1300 | mqpcb->source_gid_idx_al = | ||
1301 | attr->alt_ah_attr.grh.sgid_index; | ||
1302 | update_mask |= | ||
1303 | EHCA_BMASK_SET(MQPCB_MASK_SOURCE_GID_IDX_AL, 1); | ||
1304 | 1339 | ||
1305 | for (cnt = 0; cnt < 16; cnt++) | 1340 | for (cnt = 0; cnt < 16; cnt++) |
1306 | mqpcb->dest_gid_al.byte[cnt] = | 1341 | mqpcb->dest_gid_al.byte[cnt] = |
1307 | attr->alt_ah_attr.grh.dgid.raw[cnt]; | 1342 | attr->alt_ah_attr.grh.dgid.raw[cnt]; |
1308 | 1343 | mqpcb->source_gid_idx_al = | |
1309 | update_mask |= | 1344 | attr->alt_ah_attr.grh.sgid_index; |
1310 | EHCA_BMASK_SET(MQPCB_MASK_DEST_GID_AL, 1); | ||
1311 | mqpcb->flow_label_al = attr->alt_ah_attr.grh.flow_label; | 1345 | mqpcb->flow_label_al = attr->alt_ah_attr.grh.flow_label; |
1312 | update_mask |= | ||
1313 | EHCA_BMASK_SET(MQPCB_MASK_FLOW_LABEL_AL, 1); | ||
1314 | mqpcb->hop_limit_al = attr->alt_ah_attr.grh.hop_limit; | 1346 | mqpcb->hop_limit_al = attr->alt_ah_attr.grh.hop_limit; |
1315 | update_mask |= | ||
1316 | EHCA_BMASK_SET(MQPCB_MASK_HOP_LIMIT_AL, 1); | ||
1317 | mqpcb->traffic_class_al = | 1347 | mqpcb->traffic_class_al = |
1318 | attr->alt_ah_attr.grh.traffic_class; | 1348 | attr->alt_ah_attr.grh.traffic_class; |
1349 | |||
1319 | update_mask |= | 1350 | update_mask |= |
1351 | EHCA_BMASK_SET(MQPCB_MASK_SOURCE_GID_IDX_AL, 1) | ||
1352 | | EHCA_BMASK_SET(MQPCB_MASK_DEST_GID_AL, 1) | ||
1353 | | EHCA_BMASK_SET(MQPCB_MASK_FLOW_LABEL_AL, 1) | ||
1354 | | EHCA_BMASK_SET(MQPCB_MASK_HOP_LIMIT_AL, 1) | | ||
1320 | EHCA_BMASK_SET(MQPCB_MASK_TRAFFIC_CLASS_AL, 1); | 1355 | EHCA_BMASK_SET(MQPCB_MASK_TRAFFIC_CLASS_AL, 1); |
1321 | } | 1356 | } |
1322 | } | 1357 | } |
@@ -1338,7 +1373,14 @@ static int internal_modify_qp(struct ib_qp *ibqp, | |||
1338 | } | 1373 | } |
1339 | 1374 | ||
1340 | if (attr_mask & IB_QP_PATH_MIG_STATE) { | 1375 | if (attr_mask & IB_QP_PATH_MIG_STATE) { |
1341 | mqpcb->path_migration_state = attr->path_mig_state; | 1376 | if (attr->path_mig_state != IB_MIG_REARM |
1377 | && attr->path_mig_state != IB_MIG_MIGRATED) { | ||
1378 | ret = -EINVAL; | ||
1379 | ehca_err(ibqp->device, "Invalid mig_state=%x", | ||
1380 | attr->path_mig_state); | ||
1381 | goto modify_qp_exit2; | ||
1382 | } | ||
1383 | mqpcb->path_migration_state = attr->path_mig_state + 1; | ||
1342 | update_mask |= | 1384 | update_mask |= |
1343 | EHCA_BMASK_SET(MQPCB_MASK_PATH_MIGRATION_STATE, 1); | 1385 | EHCA_BMASK_SET(MQPCB_MASK_PATH_MIGRATION_STATE, 1); |
1344 | } | 1386 | } |
@@ -1506,7 +1548,7 @@ int ehca_query_qp(struct ib_qp *qp, | |||
1506 | 1548 | ||
1507 | qp_attr->qkey = qpcb->qkey; | 1549 | qp_attr->qkey = qpcb->qkey; |
1508 | qp_attr->path_mtu = qpcb->path_mtu; | 1550 | qp_attr->path_mtu = qpcb->path_mtu; |
1509 | qp_attr->path_mig_state = qpcb->path_migration_state; | 1551 | qp_attr->path_mig_state = qpcb->path_migration_state - 1; |
1510 | qp_attr->rq_psn = qpcb->receive_psn; | 1552 | qp_attr->rq_psn = qpcb->receive_psn; |
1511 | qp_attr->sq_psn = qpcb->send_psn; | 1553 | qp_attr->sq_psn = qpcb->send_psn; |
1512 | qp_attr->min_rnr_timer = qpcb->min_rnr_nak_timer_field; | 1554 | qp_attr->min_rnr_timer = qpcb->min_rnr_nak_timer_field; |