Lines Matching refs:tun_qp

518 	struct mlx4_ib_demux_pv_qp *tun_qp;  in mlx4_ib_send_to_slave()  local
542 tun_qp = &tun_ctx->qp[0]; in mlx4_ib_send_to_slave()
544 tun_qp = &tun_ctx->qp[1]; in mlx4_ib_send_to_slave()
571 src_qp = tun_qp->qp; in mlx4_ib_send_to_slave()
592 spin_lock(&tun_qp->tx_lock); in mlx4_ib_send_to_slave()
593 if (tun_qp->tx_ix_head - tun_qp->tx_ix_tail >= in mlx4_ib_send_to_slave()
597 tun_tx_ix = (++tun_qp->tx_ix_head) & (MLX4_NUM_TUNNEL_BUFS - 1); in mlx4_ib_send_to_slave()
598 spin_unlock(&tun_qp->tx_lock); in mlx4_ib_send_to_slave()
602 tun_mad = (struct mlx4_rcv_tunnel_mad *) (tun_qp->tx_ring[tun_tx_ix].buf.addr); in mlx4_ib_send_to_slave()
603 if (tun_qp->tx_ring[tun_tx_ix].ah) in mlx4_ib_send_to_slave()
604 rdma_destroy_ah(tun_qp->tx_ring[tun_tx_ix].ah, 0); in mlx4_ib_send_to_slave()
605 tun_qp->tx_ring[tun_tx_ix].ah = ah; in mlx4_ib_send_to_slave()
607 tun_qp->tx_ring[tun_tx_ix].buf.map, in mlx4_ib_send_to_slave()
649 tun_qp->tx_ring[tun_tx_ix].buf.map, in mlx4_ib_send_to_slave()
653 list.addr = tun_qp->tx_ring[tun_tx_ix].buf.map; in mlx4_ib_send_to_slave()
672 spin_lock(&tun_qp->tx_lock); in mlx4_ib_send_to_slave()
673 tun_qp->tx_ix_tail++; in mlx4_ib_send_to_slave()
674 spin_unlock(&tun_qp->tx_lock); in mlx4_ib_send_to_slave()
675 tun_qp->tx_ring[tun_tx_ix].ah = NULL; in mlx4_ib_send_to_slave()
1313 struct mlx4_ib_demux_pv_qp *tun_qp, in mlx4_ib_post_pv_qp_buf() argument
1321 size = (tun_qp->qp->qp_type == IB_QPT_UD) ? in mlx4_ib_post_pv_qp_buf()
1324 sg_list.addr = tun_qp->ring[index].map; in mlx4_ib_post_pv_qp_buf()
1332 MLX4_TUN_SET_WRID_QPN(tun_qp->proxy_qpt); in mlx4_ib_post_pv_qp_buf()
1333 ib_dma_sync_single_for_device(ctx->ib_dev, tun_qp->ring[index].map, in mlx4_ib_post_pv_qp_buf()
1335 return ib_post_recv(tun_qp->qp, &recv_wr, &bad_recv_wr); in mlx4_ib_post_pv_qp_buf()
1478 struct mlx4_ib_demux_pv_qp *tun_qp = &ctx->qp[MLX4_TUN_WRID_QPN(wc->wr_id)]; in mlx4_ib_multiplex_mad() local
1480 struct mlx4_tunnel_mad *tunnel = tun_qp->ring[wr_ix].addr; in mlx4_ib_multiplex_mad()
1507 ib_dma_sync_single_for_cpu(ctx->ib_dev, tun_qp->ring[wr_ix].map, in mlx4_ib_multiplex_mad()
1603 struct mlx4_ib_demux_pv_qp *tun_qp; in mlx4_ib_alloc_pv_bufs() local
1610 tun_qp = &ctx->qp[qp_type]; in mlx4_ib_alloc_pv_bufs()
1612 tun_qp->ring = kcalloc(nmbr_bufs, in mlx4_ib_alloc_pv_bufs()
1615 if (!tun_qp->ring) in mlx4_ib_alloc_pv_bufs()
1618 tun_qp->tx_ring = kcalloc(nmbr_bufs, in mlx4_ib_alloc_pv_bufs()
1621 if (!tun_qp->tx_ring) { in mlx4_ib_alloc_pv_bufs()
1622 kfree(tun_qp->ring); in mlx4_ib_alloc_pv_bufs()
1623 tun_qp->ring = NULL; in mlx4_ib_alloc_pv_bufs()
1636 tun_qp->ring[i].addr = kmalloc(rx_buf_size, GFP_KERNEL); in mlx4_ib_alloc_pv_bufs()
1637 if (!tun_qp->ring[i].addr) in mlx4_ib_alloc_pv_bufs()
1639 tun_qp->ring[i].map = ib_dma_map_single(ctx->ib_dev, in mlx4_ib_alloc_pv_bufs()
1640 tun_qp->ring[i].addr, in mlx4_ib_alloc_pv_bufs()
1643 if (ib_dma_mapping_error(ctx->ib_dev, tun_qp->ring[i].map)) { in mlx4_ib_alloc_pv_bufs()
1644 kfree(tun_qp->ring[i].addr); in mlx4_ib_alloc_pv_bufs()
1650 tun_qp->tx_ring[i].buf.addr = in mlx4_ib_alloc_pv_bufs()
1652 if (!tun_qp->tx_ring[i].buf.addr) in mlx4_ib_alloc_pv_bufs()
1654 tun_qp->tx_ring[i].buf.map = in mlx4_ib_alloc_pv_bufs()
1656 tun_qp->tx_ring[i].buf.addr, in mlx4_ib_alloc_pv_bufs()
1660 tun_qp->tx_ring[i].buf.map)) { in mlx4_ib_alloc_pv_bufs()
1661 kfree(tun_qp->tx_ring[i].buf.addr); in mlx4_ib_alloc_pv_bufs()
1664 tun_qp->tx_ring[i].ah = NULL; in mlx4_ib_alloc_pv_bufs()
1666 spin_lock_init(&tun_qp->tx_lock); in mlx4_ib_alloc_pv_bufs()
1667 tun_qp->tx_ix_head = 0; in mlx4_ib_alloc_pv_bufs()
1668 tun_qp->tx_ix_tail = 0; in mlx4_ib_alloc_pv_bufs()
1669 tun_qp->proxy_qpt = qp_type; in mlx4_ib_alloc_pv_bufs()
1676 ib_dma_unmap_single(ctx->ib_dev, tun_qp->tx_ring[i].buf.map, in mlx4_ib_alloc_pv_bufs()
1678 kfree(tun_qp->tx_ring[i].buf.addr); in mlx4_ib_alloc_pv_bufs()
1684 ib_dma_unmap_single(ctx->ib_dev, tun_qp->ring[i].map, in mlx4_ib_alloc_pv_bufs()
1686 kfree(tun_qp->ring[i].addr); in mlx4_ib_alloc_pv_bufs()
1688 kfree(tun_qp->tx_ring); in mlx4_ib_alloc_pv_bufs()
1689 tun_qp->tx_ring = NULL; in mlx4_ib_alloc_pv_bufs()
1690 kfree(tun_qp->ring); in mlx4_ib_alloc_pv_bufs()
1691 tun_qp->ring = NULL; in mlx4_ib_alloc_pv_bufs()
1699 struct mlx4_ib_demux_pv_qp *tun_qp; in mlx4_ib_free_pv_qp_bufs() local
1706 tun_qp = &ctx->qp[qp_type]; in mlx4_ib_free_pv_qp_bufs()
1717 ib_dma_unmap_single(ctx->ib_dev, tun_qp->ring[i].map, in mlx4_ib_free_pv_qp_bufs()
1719 kfree(tun_qp->ring[i].addr); in mlx4_ib_free_pv_qp_bufs()
1723 ib_dma_unmap_single(ctx->ib_dev, tun_qp->tx_ring[i].buf.map, in mlx4_ib_free_pv_qp_bufs()
1725 kfree(tun_qp->tx_ring[i].buf.addr); in mlx4_ib_free_pv_qp_bufs()
1726 if (tun_qp->tx_ring[i].ah) in mlx4_ib_free_pv_qp_bufs()
1727 rdma_destroy_ah(tun_qp->tx_ring[i].ah, 0); in mlx4_ib_free_pv_qp_bufs()
1729 kfree(tun_qp->tx_ring); in mlx4_ib_free_pv_qp_bufs()
1730 kfree(tun_qp->ring); in mlx4_ib_free_pv_qp_bufs()
1736 struct mlx4_ib_demux_pv_qp *tun_qp; in mlx4_ib_tunnel_comp_worker() local
1743 tun_qp = &ctx->qp[MLX4_TUN_WRID_QPN(wc.wr_id)]; in mlx4_ib_tunnel_comp_worker()
1748 ret = mlx4_ib_post_pv_qp_buf(ctx, tun_qp, in mlx4_ib_tunnel_comp_worker()
1756 rdma_destroy_ah(tun_qp->tx_ring[wc.wr_id & in mlx4_ib_tunnel_comp_worker()
1758 tun_qp->tx_ring[wc.wr_id & (MLX4_NUM_TUNNEL_BUFS - 1)].ah in mlx4_ib_tunnel_comp_worker()
1760 spin_lock(&tun_qp->tx_lock); in mlx4_ib_tunnel_comp_worker()
1761 tun_qp->tx_ix_tail++; in mlx4_ib_tunnel_comp_worker()
1762 spin_unlock(&tun_qp->tx_lock); in mlx4_ib_tunnel_comp_worker()
1773 rdma_destroy_ah(tun_qp->tx_ring[wc.wr_id & in mlx4_ib_tunnel_comp_worker()
1775 tun_qp->tx_ring[wc.wr_id & (MLX4_NUM_TUNNEL_BUFS - 1)].ah in mlx4_ib_tunnel_comp_worker()
1777 spin_lock(&tun_qp->tx_lock); in mlx4_ib_tunnel_comp_worker()
1778 tun_qp->tx_ix_tail++; in mlx4_ib_tunnel_comp_worker()
1779 spin_unlock(&tun_qp->tx_lock); in mlx4_ib_tunnel_comp_worker()
1798 struct mlx4_ib_demux_pv_qp *tun_qp; in create_pv_sqp() local
1807 tun_qp = &ctx->qp[qp_type]; in create_pv_sqp()
1833 tun_qp->qp = ib_create_qp(ctx->pd, &qp_init_attr.init_attr); in create_pv_sqp()
1834 if (IS_ERR(tun_qp->qp)) { in create_pv_sqp()
1835 ret = PTR_ERR(tun_qp->qp); in create_pv_sqp()
1836 tun_qp->qp = NULL; in create_pv_sqp()
1854 ret = ib_modify_qp(tun_qp->qp, &attr, qp_attr_mask_INIT); in create_pv_sqp()
1861 ret = ib_modify_qp(tun_qp->qp, &attr, IB_QP_STATE); in create_pv_sqp()
1869 ret = ib_modify_qp(tun_qp->qp, &attr, IB_QP_STATE | IB_QP_SQ_PSN); in create_pv_sqp()
1877 ret = mlx4_ib_post_pv_qp_buf(ctx, tun_qp, i); in create_pv_sqp()
1887 ib_destroy_qp(tun_qp->qp); in create_pv_sqp()
1888 tun_qp->qp = NULL; in create_pv_sqp()