Lines Matching refs:tun_qp

463 	struct mlx4_ib_demux_pv_qp *tun_qp;  in mlx4_ib_send_to_slave()  local
485 tun_qp = &tun_ctx->qp[0]; in mlx4_ib_send_to_slave()
487 tun_qp = &tun_ctx->qp[1]; in mlx4_ib_send_to_slave()
506 src_qp = tun_qp->qp; in mlx4_ib_send_to_slave()
521 spin_lock(&tun_qp->tx_lock); in mlx4_ib_send_to_slave()
522 if (tun_qp->tx_ix_head - tun_qp->tx_ix_tail >= in mlx4_ib_send_to_slave()
526 tun_tx_ix = (++tun_qp->tx_ix_head) & (MLX4_NUM_TUNNEL_BUFS - 1); in mlx4_ib_send_to_slave()
527 spin_unlock(&tun_qp->tx_lock); in mlx4_ib_send_to_slave()
531 tun_mad = (struct mlx4_rcv_tunnel_mad *) (tun_qp->tx_ring[tun_tx_ix].buf.addr); in mlx4_ib_send_to_slave()
532 if (tun_qp->tx_ring[tun_tx_ix].ah) in mlx4_ib_send_to_slave()
533 ib_destroy_ah(tun_qp->tx_ring[tun_tx_ix].ah); in mlx4_ib_send_to_slave()
534 tun_qp->tx_ring[tun_tx_ix].ah = ah; in mlx4_ib_send_to_slave()
536 tun_qp->tx_ring[tun_tx_ix].buf.map, in mlx4_ib_send_to_slave()
578 tun_qp->tx_ring[tun_tx_ix].buf.map, in mlx4_ib_send_to_slave()
582 list.addr = tun_qp->tx_ring[tun_tx_ix].buf.map; in mlx4_ib_send_to_slave()
1136 struct mlx4_ib_demux_pv_qp *tun_qp, in mlx4_ib_post_pv_qp_buf() argument
1143 size = (tun_qp->qp->qp_type == IB_QPT_UD) ? in mlx4_ib_post_pv_qp_buf()
1146 sg_list.addr = tun_qp->ring[index].map; in mlx4_ib_post_pv_qp_buf()
1154 MLX4_TUN_SET_WRID_QPN(tun_qp->proxy_qpt); in mlx4_ib_post_pv_qp_buf()
1155 ib_dma_sync_single_for_device(ctx->ib_dev, tun_qp->ring[index].map, in mlx4_ib_post_pv_qp_buf()
1157 return ib_post_recv(tun_qp->qp, &recv_wr, &bad_recv_wr); in mlx4_ib_post_pv_qp_buf()
1306 struct mlx4_ib_demux_pv_qp *tun_qp = &ctx->qp[MLX4_TUN_WRID_QPN(wc->wr_id)]; in mlx4_ib_multiplex_mad() local
1308 struct mlx4_tunnel_mad *tunnel = tun_qp->ring[wr_ix].addr; in mlx4_ib_multiplex_mad()
1332 ib_dma_sync_single_for_cpu(ctx->ib_dev, tun_qp->ring[wr_ix].map, in mlx4_ib_multiplex_mad()
1421 struct mlx4_ib_demux_pv_qp *tun_qp; in mlx4_ib_alloc_pv_bufs() local
1427 tun_qp = &ctx->qp[qp_type]; in mlx4_ib_alloc_pv_bufs()
1429 tun_qp->ring = kzalloc(sizeof (struct mlx4_ib_buf) * MLX4_NUM_TUNNEL_BUFS, in mlx4_ib_alloc_pv_bufs()
1431 if (!tun_qp->ring) in mlx4_ib_alloc_pv_bufs()
1434 tun_qp->tx_ring = kcalloc(MLX4_NUM_TUNNEL_BUFS, in mlx4_ib_alloc_pv_bufs()
1437 if (!tun_qp->tx_ring) { in mlx4_ib_alloc_pv_bufs()
1438 kfree(tun_qp->ring); in mlx4_ib_alloc_pv_bufs()
1439 tun_qp->ring = NULL; in mlx4_ib_alloc_pv_bufs()
1452 tun_qp->ring[i].addr = kmalloc(rx_buf_size, GFP_KERNEL); in mlx4_ib_alloc_pv_bufs()
1453 if (!tun_qp->ring[i].addr) in mlx4_ib_alloc_pv_bufs()
1455 tun_qp->ring[i].map = ib_dma_map_single(ctx->ib_dev, in mlx4_ib_alloc_pv_bufs()
1456 tun_qp->ring[i].addr, in mlx4_ib_alloc_pv_bufs()
1459 if (ib_dma_mapping_error(ctx->ib_dev, tun_qp->ring[i].map)) { in mlx4_ib_alloc_pv_bufs()
1460 kfree(tun_qp->ring[i].addr); in mlx4_ib_alloc_pv_bufs()
1466 tun_qp->tx_ring[i].buf.addr = in mlx4_ib_alloc_pv_bufs()
1468 if (!tun_qp->tx_ring[i].buf.addr) in mlx4_ib_alloc_pv_bufs()
1470 tun_qp->tx_ring[i].buf.map = in mlx4_ib_alloc_pv_bufs()
1472 tun_qp->tx_ring[i].buf.addr, in mlx4_ib_alloc_pv_bufs()
1476 tun_qp->tx_ring[i].buf.map)) { in mlx4_ib_alloc_pv_bufs()
1477 kfree(tun_qp->tx_ring[i].buf.addr); in mlx4_ib_alloc_pv_bufs()
1480 tun_qp->tx_ring[i].ah = NULL; in mlx4_ib_alloc_pv_bufs()
1482 spin_lock_init(&tun_qp->tx_lock); in mlx4_ib_alloc_pv_bufs()
1483 tun_qp->tx_ix_head = 0; in mlx4_ib_alloc_pv_bufs()
1484 tun_qp->tx_ix_tail = 0; in mlx4_ib_alloc_pv_bufs()
1485 tun_qp->proxy_qpt = qp_type; in mlx4_ib_alloc_pv_bufs()
1492 ib_dma_unmap_single(ctx->ib_dev, tun_qp->tx_ring[i].buf.map, in mlx4_ib_alloc_pv_bufs()
1494 kfree(tun_qp->tx_ring[i].buf.addr); in mlx4_ib_alloc_pv_bufs()
1496 kfree(tun_qp->tx_ring); in mlx4_ib_alloc_pv_bufs()
1497 tun_qp->tx_ring = NULL; in mlx4_ib_alloc_pv_bufs()
1502 ib_dma_unmap_single(ctx->ib_dev, tun_qp->ring[i].map, in mlx4_ib_alloc_pv_bufs()
1504 kfree(tun_qp->ring[i].addr); in mlx4_ib_alloc_pv_bufs()
1506 kfree(tun_qp->ring); in mlx4_ib_alloc_pv_bufs()
1507 tun_qp->ring = NULL; in mlx4_ib_alloc_pv_bufs()
1515 struct mlx4_ib_demux_pv_qp *tun_qp; in mlx4_ib_free_pv_qp_bufs() local
1521 tun_qp = &ctx->qp[qp_type]; in mlx4_ib_free_pv_qp_bufs()
1532 ib_dma_unmap_single(ctx->ib_dev, tun_qp->ring[i].map, in mlx4_ib_free_pv_qp_bufs()
1534 kfree(tun_qp->ring[i].addr); in mlx4_ib_free_pv_qp_bufs()
1538 ib_dma_unmap_single(ctx->ib_dev, tun_qp->tx_ring[i].buf.map, in mlx4_ib_free_pv_qp_bufs()
1540 kfree(tun_qp->tx_ring[i].buf.addr); in mlx4_ib_free_pv_qp_bufs()
1541 if (tun_qp->tx_ring[i].ah) in mlx4_ib_free_pv_qp_bufs()
1542 ib_destroy_ah(tun_qp->tx_ring[i].ah); in mlx4_ib_free_pv_qp_bufs()
1544 kfree(tun_qp->tx_ring); in mlx4_ib_free_pv_qp_bufs()
1545 kfree(tun_qp->ring); in mlx4_ib_free_pv_qp_bufs()
1551 struct mlx4_ib_demux_pv_qp *tun_qp; in mlx4_ib_tunnel_comp_worker() local
1558 tun_qp = &ctx->qp[MLX4_TUN_WRID_QPN(wc.wr_id)]; in mlx4_ib_tunnel_comp_worker()
1563 ret = mlx4_ib_post_pv_qp_buf(ctx, tun_qp, in mlx4_ib_tunnel_comp_worker()
1574 ib_destroy_ah(tun_qp->tx_ring[wc.wr_id & in mlx4_ib_tunnel_comp_worker()
1576 tun_qp->tx_ring[wc.wr_id & (MLX4_NUM_TUNNEL_BUFS - 1)].ah in mlx4_ib_tunnel_comp_worker()
1578 spin_lock(&tun_qp->tx_lock); in mlx4_ib_tunnel_comp_worker()
1579 tun_qp->tx_ix_tail++; in mlx4_ib_tunnel_comp_worker()
1580 spin_unlock(&tun_qp->tx_lock); in mlx4_ib_tunnel_comp_worker()
1591 ib_destroy_ah(tun_qp->tx_ring[wc.wr_id & in mlx4_ib_tunnel_comp_worker()
1593 tun_qp->tx_ring[wc.wr_id & (MLX4_NUM_TUNNEL_BUFS - 1)].ah in mlx4_ib_tunnel_comp_worker()
1595 spin_lock(&tun_qp->tx_lock); in mlx4_ib_tunnel_comp_worker()
1596 tun_qp->tx_ix_tail++; in mlx4_ib_tunnel_comp_worker()
1597 spin_unlock(&tun_qp->tx_lock); in mlx4_ib_tunnel_comp_worker()
1616 struct mlx4_ib_demux_pv_qp *tun_qp; in create_pv_sqp() local
1624 tun_qp = &ctx->qp[qp_type]; in create_pv_sqp()
1650 tun_qp->qp = ib_create_qp(ctx->pd, &qp_init_attr.init_attr); in create_pv_sqp()
1651 if (IS_ERR(tun_qp->qp)) { in create_pv_sqp()
1652 ret = PTR_ERR(tun_qp->qp); in create_pv_sqp()
1653 tun_qp->qp = NULL; in create_pv_sqp()
1671 ret = ib_modify_qp(tun_qp->qp, &attr, qp_attr_mask_INIT); in create_pv_sqp()
1678 ret = ib_modify_qp(tun_qp->qp, &attr, IB_QP_STATE); in create_pv_sqp()
1686 ret = ib_modify_qp(tun_qp->qp, &attr, IB_QP_STATE | IB_QP_SQ_PSN); in create_pv_sqp()
1694 ret = mlx4_ib_post_pv_qp_buf(ctx, tun_qp, i); in create_pv_sqp()
1704 ib_destroy_qp(tun_qp->qp); in create_pv_sqp()
1705 tun_qp->qp = NULL; in create_pv_sqp()