Lines Matching refs:tun_qp

519 	struct mlx4_ib_demux_pv_qp *tun_qp;  in mlx4_ib_send_to_slave()  local
543 tun_qp = &tun_ctx->qp[0]; in mlx4_ib_send_to_slave()
545 tun_qp = &tun_ctx->qp[1]; in mlx4_ib_send_to_slave()
572 src_qp = tun_qp->qp; in mlx4_ib_send_to_slave()
593 spin_lock(&tun_qp->tx_lock); in mlx4_ib_send_to_slave()
594 if (tun_qp->tx_ix_head - tun_qp->tx_ix_tail >= in mlx4_ib_send_to_slave()
598 tun_tx_ix = (++tun_qp->tx_ix_head) & (MLX4_NUM_TUNNEL_BUFS - 1); in mlx4_ib_send_to_slave()
599 spin_unlock(&tun_qp->tx_lock); in mlx4_ib_send_to_slave()
603 tun_mad = (struct mlx4_rcv_tunnel_mad *) (tun_qp->tx_ring[tun_tx_ix].buf.addr); in mlx4_ib_send_to_slave()
604 if (tun_qp->tx_ring[tun_tx_ix].ah) in mlx4_ib_send_to_slave()
605 rdma_destroy_ah(tun_qp->tx_ring[tun_tx_ix].ah, 0); in mlx4_ib_send_to_slave()
606 tun_qp->tx_ring[tun_tx_ix].ah = ah; in mlx4_ib_send_to_slave()
608 tun_qp->tx_ring[tun_tx_ix].buf.map, in mlx4_ib_send_to_slave()
650 tun_qp->tx_ring[tun_tx_ix].buf.map, in mlx4_ib_send_to_slave()
654 list.addr = tun_qp->tx_ring[tun_tx_ix].buf.map; in mlx4_ib_send_to_slave()
673 spin_lock(&tun_qp->tx_lock); in mlx4_ib_send_to_slave()
674 tun_qp->tx_ix_tail++; in mlx4_ib_send_to_slave()
675 spin_unlock(&tun_qp->tx_lock); in mlx4_ib_send_to_slave()
676 tun_qp->tx_ring[tun_tx_ix].ah = NULL; in mlx4_ib_send_to_slave()
1315 struct mlx4_ib_demux_pv_qp *tun_qp, in mlx4_ib_post_pv_qp_buf() argument
1323 size = (tun_qp->qp->qp_type == IB_QPT_UD) ? in mlx4_ib_post_pv_qp_buf()
1326 sg_list.addr = tun_qp->ring[index].map; in mlx4_ib_post_pv_qp_buf()
1334 MLX4_TUN_SET_WRID_QPN(tun_qp->proxy_qpt); in mlx4_ib_post_pv_qp_buf()
1335 ib_dma_sync_single_for_device(ctx->ib_dev, tun_qp->ring[index].map, in mlx4_ib_post_pv_qp_buf()
1337 return ib_post_recv(tun_qp->qp, &recv_wr, &bad_recv_wr); in mlx4_ib_post_pv_qp_buf()
1480 struct mlx4_ib_demux_pv_qp *tun_qp = &ctx->qp[MLX4_TUN_WRID_QPN(wc->wr_id)]; in mlx4_ib_multiplex_mad() local
1482 struct mlx4_tunnel_mad *tunnel = tun_qp->ring[wr_ix].addr; in mlx4_ib_multiplex_mad()
1509 ib_dma_sync_single_for_cpu(ctx->ib_dev, tun_qp->ring[wr_ix].map, in mlx4_ib_multiplex_mad()
1606 struct mlx4_ib_demux_pv_qp *tun_qp; in mlx4_ib_alloc_pv_bufs() local
1613 tun_qp = &ctx->qp[qp_type]; in mlx4_ib_alloc_pv_bufs()
1615 tun_qp->ring = kcalloc(nmbr_bufs, in mlx4_ib_alloc_pv_bufs()
1618 if (!tun_qp->ring) in mlx4_ib_alloc_pv_bufs()
1621 tun_qp->tx_ring = kcalloc(nmbr_bufs, in mlx4_ib_alloc_pv_bufs()
1624 if (!tun_qp->tx_ring) { in mlx4_ib_alloc_pv_bufs()
1625 kfree(tun_qp->ring); in mlx4_ib_alloc_pv_bufs()
1626 tun_qp->ring = NULL; in mlx4_ib_alloc_pv_bufs()
1639 tun_qp->ring[i].addr = kmalloc(rx_buf_size, GFP_KERNEL); in mlx4_ib_alloc_pv_bufs()
1640 if (!tun_qp->ring[i].addr) in mlx4_ib_alloc_pv_bufs()
1642 tun_qp->ring[i].map = ib_dma_map_single(ctx->ib_dev, in mlx4_ib_alloc_pv_bufs()
1643 tun_qp->ring[i].addr, in mlx4_ib_alloc_pv_bufs()
1646 if (ib_dma_mapping_error(ctx->ib_dev, tun_qp->ring[i].map)) { in mlx4_ib_alloc_pv_bufs()
1647 kfree(tun_qp->ring[i].addr); in mlx4_ib_alloc_pv_bufs()
1653 tun_qp->tx_ring[i].buf.addr = in mlx4_ib_alloc_pv_bufs()
1655 if (!tun_qp->tx_ring[i].buf.addr) in mlx4_ib_alloc_pv_bufs()
1657 tun_qp->tx_ring[i].buf.map = in mlx4_ib_alloc_pv_bufs()
1659 tun_qp->tx_ring[i].buf.addr, in mlx4_ib_alloc_pv_bufs()
1663 tun_qp->tx_ring[i].buf.map)) { in mlx4_ib_alloc_pv_bufs()
1664 kfree(tun_qp->tx_ring[i].buf.addr); in mlx4_ib_alloc_pv_bufs()
1667 tun_qp->tx_ring[i].ah = NULL; in mlx4_ib_alloc_pv_bufs()
1669 spin_lock_init(&tun_qp->tx_lock); in mlx4_ib_alloc_pv_bufs()
1670 tun_qp->tx_ix_head = 0; in mlx4_ib_alloc_pv_bufs()
1671 tun_qp->tx_ix_tail = 0; in mlx4_ib_alloc_pv_bufs()
1672 tun_qp->proxy_qpt = qp_type; in mlx4_ib_alloc_pv_bufs()
1679 ib_dma_unmap_single(ctx->ib_dev, tun_qp->tx_ring[i].buf.map, in mlx4_ib_alloc_pv_bufs()
1681 kfree(tun_qp->tx_ring[i].buf.addr); in mlx4_ib_alloc_pv_bufs()
1687 ib_dma_unmap_single(ctx->ib_dev, tun_qp->ring[i].map, in mlx4_ib_alloc_pv_bufs()
1689 kfree(tun_qp->ring[i].addr); in mlx4_ib_alloc_pv_bufs()
1691 kfree(tun_qp->tx_ring); in mlx4_ib_alloc_pv_bufs()
1692 tun_qp->tx_ring = NULL; in mlx4_ib_alloc_pv_bufs()
1693 kfree(tun_qp->ring); in mlx4_ib_alloc_pv_bufs()
1694 tun_qp->ring = NULL; in mlx4_ib_alloc_pv_bufs()
1702 struct mlx4_ib_demux_pv_qp *tun_qp; in mlx4_ib_free_pv_qp_bufs() local
1709 tun_qp = &ctx->qp[qp_type]; in mlx4_ib_free_pv_qp_bufs()
1720 ib_dma_unmap_single(ctx->ib_dev, tun_qp->ring[i].map, in mlx4_ib_free_pv_qp_bufs()
1722 kfree(tun_qp->ring[i].addr); in mlx4_ib_free_pv_qp_bufs()
1726 ib_dma_unmap_single(ctx->ib_dev, tun_qp->tx_ring[i].buf.map, in mlx4_ib_free_pv_qp_bufs()
1728 kfree(tun_qp->tx_ring[i].buf.addr); in mlx4_ib_free_pv_qp_bufs()
1729 if (tun_qp->tx_ring[i].ah) in mlx4_ib_free_pv_qp_bufs()
1730 rdma_destroy_ah(tun_qp->tx_ring[i].ah, 0); in mlx4_ib_free_pv_qp_bufs()
1732 kfree(tun_qp->tx_ring); in mlx4_ib_free_pv_qp_bufs()
1733 kfree(tun_qp->ring); in mlx4_ib_free_pv_qp_bufs()
1739 struct mlx4_ib_demux_pv_qp *tun_qp; in mlx4_ib_tunnel_comp_worker() local
1746 tun_qp = &ctx->qp[MLX4_TUN_WRID_QPN(wc.wr_id)]; in mlx4_ib_tunnel_comp_worker()
1751 ret = mlx4_ib_post_pv_qp_buf(ctx, tun_qp, in mlx4_ib_tunnel_comp_worker()
1759 rdma_destroy_ah(tun_qp->tx_ring[wc.wr_id & in mlx4_ib_tunnel_comp_worker()
1761 tun_qp->tx_ring[wc.wr_id & (MLX4_NUM_TUNNEL_BUFS - 1)].ah in mlx4_ib_tunnel_comp_worker()
1763 spin_lock(&tun_qp->tx_lock); in mlx4_ib_tunnel_comp_worker()
1764 tun_qp->tx_ix_tail++; in mlx4_ib_tunnel_comp_worker()
1765 spin_unlock(&tun_qp->tx_lock); in mlx4_ib_tunnel_comp_worker()
1776 rdma_destroy_ah(tun_qp->tx_ring[wc.wr_id & in mlx4_ib_tunnel_comp_worker()
1778 tun_qp->tx_ring[wc.wr_id & (MLX4_NUM_TUNNEL_BUFS - 1)].ah in mlx4_ib_tunnel_comp_worker()
1780 spin_lock(&tun_qp->tx_lock); in mlx4_ib_tunnel_comp_worker()
1781 tun_qp->tx_ix_tail++; in mlx4_ib_tunnel_comp_worker()
1782 spin_unlock(&tun_qp->tx_lock); in mlx4_ib_tunnel_comp_worker()
1801 struct mlx4_ib_demux_pv_qp *tun_qp; in create_pv_sqp() local
1810 tun_qp = &ctx->qp[qp_type]; in create_pv_sqp()
1836 tun_qp->qp = ib_create_qp(ctx->pd, &qp_init_attr.init_attr); in create_pv_sqp()
1837 if (IS_ERR(tun_qp->qp)) { in create_pv_sqp()
1838 ret = PTR_ERR(tun_qp->qp); in create_pv_sqp()
1839 tun_qp->qp = NULL; in create_pv_sqp()
1857 ret = ib_modify_qp(tun_qp->qp, &attr, qp_attr_mask_INIT); in create_pv_sqp()
1864 ret = ib_modify_qp(tun_qp->qp, &attr, IB_QP_STATE); in create_pv_sqp()
1872 ret = ib_modify_qp(tun_qp->qp, &attr, IB_QP_STATE | IB_QP_SQ_PSN); in create_pv_sqp()
1880 ret = mlx4_ib_post_pv_qp_buf(ctx, tun_qp, i); in create_pv_sqp()
1890 ib_destroy_qp(tun_qp->qp); in create_pv_sqp()
1891 tun_qp->qp = NULL; in create_pv_sqp()