Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'rdma-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband

Pull infiniband fixes from Roland Dreier:
"Small batch of fixes for 3.7:
- Fix crash in error path in cxgb4
- Fix build error on 32 bits in mlx4
- Fix SR-IOV bugs in mlx4"

* tag 'rdma-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband:
mlx4_core: Perform correct resource cleanup if mlx4_QUERY_ADAPTER() fails
mlx4_core: Remove annoying debug messages from SR-IOV flow
RDMA/cxgb4: Don't free chunk that we have failed to allocate
IB/mlx4: Synchronize cleanup of MCGs in MCG paravirtualization
IB/mlx4: Fix QP1 P_Key processing in the Primary Physical Function (PPF)
IB/mlx4: Fix build error on platforms where UL is not 64 bits

+56 -68
+1 -1
drivers/infiniband/hw/cxgb4/mem.c
··· 468 468 ret = alloc_pbl(mhp, npages); 469 469 if (ret) { 470 470 kfree(page_list); 471 - goto err_pbl; 471 + goto err; 472 472 } 473 473 474 474 ret = write_pbl(&mhp->rhp->rdev, page_list, mhp->attr.pbl_addr,
+1 -1
drivers/infiniband/hw/mlx4/alias_GUID.c
··· 107 107 { 108 108 if (index >= NUM_ALIAS_GUID_PER_PORT) { 109 109 pr_err("%s: ERROR: asked for index:%d\n", __func__, index); 110 - return (__force __be64) ((u64) 0xFFFFFFFFFFFFFFFFUL); 110 + return (__force __be64) -1; 111 111 } 112 112 return *(__be64 *)&dev->sriov.demux[port - 1].guid_cache[index]; 113 113 }
+40 -45
drivers/infiniband/hw/mlx4/mad.c
··· 409 409 } 410 410 411 411 412 - static int get_pkey_phys_indices(struct mlx4_ib_dev *ibdev, u8 port, u8 ph_pkey_ix, 413 - u8 *full_pk_ix, u8 *partial_pk_ix, 414 - int *is_full_member) 412 + static int find_slave_port_pkey_ix(struct mlx4_ib_dev *dev, int slave, 413 + u8 port, u16 pkey, u16 *ix) 415 414 { 416 - u16 search_pkey; 417 - int fm; 418 - int err = 0; 419 - u16 pk; 415 + int i, ret; 416 + u8 unassigned_pkey_ix, pkey_ix, partial_ix = 0xFF; 417 + u16 slot_pkey; 420 418 421 - err = ib_get_cached_pkey(&ibdev->ib_dev, port, ph_pkey_ix, &search_pkey); 422 - if (err) 423 - return err; 419 + if (slave == mlx4_master_func_num(dev->dev)) 420 + return ib_find_cached_pkey(&dev->ib_dev, port, pkey, ix); 424 421 425 - fm = (search_pkey & 0x8000) ? 1 : 0; 426 - if (fm) { 427 - *full_pk_ix = ph_pkey_ix; 428 - search_pkey &= 0x7FFF; 429 - } else { 430 - *partial_pk_ix = ph_pkey_ix; 431 - search_pkey |= 0x8000; 422 + unassigned_pkey_ix = dev->dev->phys_caps.pkey_phys_table_len[port] - 1; 423 + 424 + for (i = 0; i < dev->dev->caps.pkey_table_len[port]; i++) { 425 + if (dev->pkeys.virt2phys_pkey[slave][port - 1][i] == unassigned_pkey_ix) 426 + continue; 427 + 428 + pkey_ix = dev->pkeys.virt2phys_pkey[slave][port - 1][i]; 429 + 430 + ret = ib_get_cached_pkey(&dev->ib_dev, port, pkey_ix, &slot_pkey); 431 + if (ret) 432 + continue; 433 + if ((slot_pkey & 0x7FFF) == (pkey & 0x7FFF)) { 434 + if (slot_pkey & 0x8000) { 435 + *ix = (u16) pkey_ix; 436 + return 0; 437 + } else { 438 + /* take first partial pkey index found */ 439 + if (partial_ix == 0xFF) 440 + partial_ix = pkey_ix; 441 + } 442 + } 432 443 } 433 444 434 - if (ib_find_exact_cached_pkey(&ibdev->ib_dev, port, search_pkey, &pk)) 435 - pk = 0xFFFF; 445 + if (partial_ix < 0xFF) { 446 + *ix = (u16) partial_ix; 447 + return 0; 448 + } 436 449 437 - if (fm) 438 - *partial_pk_ix = (pk & 0xFF); 439 - else 440 - *full_pk_ix = (pk & 0xFF); 441 - 442 - *is_full_member = fm; 443 - return err; 450 + return -EINVAL; 444 451 } 445 452 446 453 int mlx4_ib_send_to_slave(struct mlx4_ib_dev *dev, int slave, u8 port, ··· 465 458 unsigned tun_tx_ix = 0; 466 459 int dqpn; 467 460 int ret = 0; 468 - int i; 469 - int is_full_member = 0; 470 461 u16 tun_pkey_ix; 471 - u8 ph_pkey_ix, full_pk_ix = 0, partial_pk_ix = 0; 462 + u16 cached_pkey; 472 463 473 464 if (dest_qpt > IB_QPT_GSI) 474 465 return -EINVAL; ··· 486 481 else 487 482 tun_qp = &tun_ctx->qp[1]; 488 483 489 - /* compute pkey index for slave */ 490 - /* get physical pkey -- virtualized Dom0 pkey to phys*/ 484 + /* compute P_Key index to put in tunnel header for slave */ 491 485 if (dest_qpt) { 492 - ph_pkey_ix = 493 - dev->pkeys.virt2phys_pkey[mlx4_master_func_num(dev->dev)][port - 1][wc->pkey_index]; 494 - 495 - /* now, translate this to the slave pkey index */ 496 - ret = get_pkey_phys_indices(dev, port, ph_pkey_ix, &full_pk_ix, 497 - &partial_pk_ix, &is_full_member); 486 + u16 pkey_ix; 487 + ret = ib_get_cached_pkey(&dev->ib_dev, port, wc->pkey_index, &cached_pkey); 498 488 if (ret) 499 489 return -EINVAL; 500 490 501 - for (i = 0; i < dev->dev->caps.pkey_table_len[port]; i++) { 502 - if ((dev->pkeys.virt2phys_pkey[slave][port - 1][i] == full_pk_ix) || 503 - (is_full_member && 504 - (dev->pkeys.virt2phys_pkey[slave][port - 1][i] == partial_pk_ix))) 505 - break; 506 - } 507 - if (i == dev->dev->caps.pkey_table_len[port]) 491 + ret = find_slave_port_pkey_ix(dev, slave, port, cached_pkey, &pkey_ix); 492 + if (ret) 508 493 return -EINVAL; 509 - tun_pkey_ix = i; 494 + tun_pkey_ix = pkey_ix; 510 495 } else 511 496 tun_pkey_ix = dev->pkeys.virt2phys_pkey[slave][port - 1][0]; 512 497
+10 -8
drivers/infiniband/hw/mlx4/mcg.c
··· 233 233 234 234 ib_query_ah(dev->sm_ah[ctx->port - 1], &ah_attr); 235 235 236 - wc.pkey_index = 0; 236 + if (ib_find_cached_pkey(&dev->ib_dev, ctx->port, IB_DEFAULT_PKEY_FULL, &wc.pkey_index)) 237 + return -EINVAL; 237 238 wc.sl = 0; 238 239 wc.dlid_path_bits = 0; 239 240 wc.port_num = ctx->port; ··· 1075 1074 unsigned long end; 1076 1075 int count; 1077 1076 1078 - if (ctx->flushing) 1079 - return; 1080 - 1081 - ctx->flushing = 1; 1082 1077 for (i = 0; i < MAX_VFS; ++i) 1083 1078 clean_vf_mcast(ctx, i); 1084 1079 ··· 1104 1107 force_clean_group(group); 1105 1108 } 1106 1109 mutex_unlock(&ctx->mcg_table_lock); 1107 - 1108 - if (!destroy_wq) 1109 - ctx->flushing = 0; 1110 1110 } 1111 1111 1112 1112 struct clean_work { ··· 1117 1123 struct clean_work *cw = container_of(work, struct clean_work, work); 1118 1124 1119 1125 _mlx4_ib_mcg_port_cleanup(cw->ctx, cw->destroy_wq); 1126 + cw->ctx->flushing = 0; 1120 1127 kfree(cw); 1121 1128 } 1122 1129 ··· 1125 1130 { 1126 1131 struct clean_work *work; 1127 1132 1133 + if (ctx->flushing) 1134 + return; 1135 + 1136 + ctx->flushing = 1; 1137 + 1128 1138 if (destroy_wq) { 1129 1139 _mlx4_ib_mcg_port_cleanup(ctx, destroy_wq); 1140 + ctx->flushing = 0; 1130 1141 return; 1131 1142 } 1132 1143 1133 1144 work = kmalloc(sizeof *work, GFP_KERNEL); 1134 1145 if (!work) { 1146 + ctx->flushing = 0; 1135 1147 mcg_warn("failed allocating work for cleanup\n"); 1136 1148 return; 1137 1149 }
-6
drivers/net/ethernet/mellanox/mlx4/eq.c
··· 329 329 ctx = &priv->mfunc.master.slave_state[slave]; 330 330 spin_lock_irqsave(&ctx->lock, flags); 331 331 332 - mlx4_dbg(dev, "%s: slave: %d, current state: %d new event :%d\n", 333 - __func__, slave, cur_state, event); 334 - 335 332 switch (cur_state) { 336 333 case SLAVE_PORT_DOWN: 337 334 if (MLX4_PORT_STATE_DEV_EVENT_PORT_UP == event) ··· 363 366 goto out; 364 367 } 365 368 ret = mlx4_get_slave_port_state(dev, slave, port); 366 - mlx4_dbg(dev, "%s: slave: %d, current state: %d new event" 367 - " :%d gen_event: %d\n", 368 - __func__, slave, cur_state, event, *gen_event); 369 369 370 370 out: 371 371 spin_unlock_irqrestore(&ctx->lock, flags);
+4 -1
drivers/net/ethernet/mellanox/mlx4/main.c
··· 1405 1405 unmap_bf_area(dev); 1406 1406 1407 1407 err_close: 1408 - mlx4_close_hca(dev); 1408 + if (mlx4_is_slave(dev)) 1409 + mlx4_slave_exit(dev); 1410 + else 1411 + mlx4_CLOSE_HCA(dev, 0); 1409 1412 1410 1413 err_free_icm: 1411 1414 if (!mlx4_is_slave(dev))
-6
drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
··· 330 330 331 331 new_index = priv->virt2phys_pkey[slave][port - 1][orig_index]; 332 332 *(u8 *)(inbox->buf + 35) = new_index; 333 - 334 - mlx4_dbg(dev, "port = %d, orig pkey index = %d, " 335 - "new pkey index = %d\n", port, orig_index, new_index); 336 333 } 337 334 338 335 static void update_gid(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *inbox, ··· 348 351 if (optpar & MLX4_QP_OPTPAR_ALT_ADDR_PATH) 349 352 qp_ctx->alt_path.mgid_index = slave & 0x7F; 350 353 } 351 - 352 - mlx4_dbg(dev, "slave %d, new gid index: 0x%x ", 353 - slave, qp_ctx->pri_path.mgid_index); 354 354 } 355 355 356 356 static int mpt_mask(struct mlx4_dev *dev)