Lines Matching defs:tun_qp

490 	struct mlx4_ib_demux_pv_qp *tun_qp;
512 tun_qp = &tun_ctx->qp[0];
514 tun_qp = &tun_ctx->qp[1];
533 src_qp = tun_qp->qp;
548 spin_lock(&tun_qp->tx_lock);
549 if (tun_qp->tx_ix_head - tun_qp->tx_ix_tail >=
553 tun_tx_ix = (++tun_qp->tx_ix_head) & (MLX4_NUM_TUNNEL_BUFS - 1);
554 spin_unlock(&tun_qp->tx_lock);
558 tun_mad = (struct mlx4_rcv_tunnel_mad *) (tun_qp->tx_ring[tun_tx_ix].buf.addr);
559 if (tun_qp->tx_ring[tun_tx_ix].ah)
560 ib_destroy_ah(tun_qp->tx_ring[tun_tx_ix].ah);
561 tun_qp->tx_ring[tun_tx_ix].ah = ah;
563 tun_qp->tx_ring[tun_tx_ix].buf.map,
607 tun_qp->tx_ring[tun_tx_ix].buf.map,
611 list.addr = tun_qp->tx_ring[tun_tx_ix].buf.map;
630 spin_lock(&tun_qp->tx_lock);
631 tun_qp->tx_ix_tail++;
632 spin_unlock(&tun_qp->tx_lock);
633 tun_qp->tx_ring[tun_tx_ix].ah = NULL;
1274 struct mlx4_ib_demux_pv_qp *tun_qp,
1281 size = (tun_qp->qp->qp_type == IB_QPT_UD) ?
1284 sg_list.addr = tun_qp->ring[index].map;
1292 MLX4_TUN_SET_WRID_QPN(tun_qp->proxy_qpt);
1293 ib_dma_sync_single_for_device(ctx->ib_dev, tun_qp->ring[index].map,
1295 return ib_post_recv(tun_qp->qp, &recv_wr, &bad_recv_wr);
1450 struct mlx4_ib_demux_pv_qp *tun_qp = &ctx->qp[MLX4_TUN_WRID_QPN(wc->wr_id)];
1452 struct mlx4_tunnel_mad *tunnel = tun_qp->ring[wr_ix].addr;
1476 ib_dma_sync_single_for_cpu(ctx->ib_dev, tun_qp->ring[wr_ix].map,
1565 struct mlx4_ib_demux_pv_qp *tun_qp;
1571 tun_qp = &ctx->qp[qp_type];
1573 tun_qp->ring = kzalloc(sizeof (struct mlx4_ib_buf) * MLX4_NUM_TUNNEL_BUFS,
1575 if (!tun_qp->ring)
1578 tun_qp->tx_ring = kcalloc(MLX4_NUM_TUNNEL_BUFS,
1581 if (!tun_qp->tx_ring) {
1582 kfree(tun_qp->ring);
1583 tun_qp->ring = NULL;
1596 tun_qp->ring[i].addr = kmalloc(rx_buf_size, GFP_KERNEL);
1597 if (!tun_qp->ring[i].addr)
1599 tun_qp->ring[i].map = ib_dma_map_single(ctx->ib_dev,
1600 tun_qp->ring[i].addr,
1603 if (ib_dma_mapping_error(ctx->ib_dev, tun_qp->ring[i].map)) {
1604 kfree(tun_qp->ring[i].addr);
1610 tun_qp->tx_ring[i].buf.addr =
1612 if (!tun_qp->tx_ring[i].buf.addr)
1614 tun_qp->tx_ring[i].buf.map =
1616 tun_qp->tx_ring[i].buf.addr,
1620 tun_qp->tx_ring[i].buf.map)) {
1621 kfree(tun_qp->tx_ring[i].buf.addr);
1624 tun_qp->tx_ring[i].ah = NULL;
1626 spin_lock_init(&tun_qp->tx_lock);
1627 tun_qp->tx_ix_head = 0;
1628 tun_qp->tx_ix_tail = 0;
1629 tun_qp->proxy_qpt = qp_type;
1636 ib_dma_unmap_single(ctx->ib_dev, tun_qp->tx_ring[i].buf.map,
1638 kfree(tun_qp->tx_ring[i].buf.addr);
1640 kfree(tun_qp->tx_ring);
1641 tun_qp->tx_ring = NULL;
1646 ib_dma_unmap_single(ctx->ib_dev, tun_qp->ring[i].map,
1648 kfree(tun_qp->ring[i].addr);
1650 kfree(tun_qp->ring);
1651 tun_qp->ring = NULL;
1659 struct mlx4_ib_demux_pv_qp *tun_qp;
1665 tun_qp = &ctx->qp[qp_type];
1676 ib_dma_unmap_single(ctx->ib_dev, tun_qp->ring[i].map,
1678 kfree(tun_qp->ring[i].addr);
1682 ib_dma_unmap_single(ctx->ib_dev, tun_qp->tx_ring[i].buf.map,
1684 kfree(tun_qp->tx_ring[i].buf.addr);
1685 if (tun_qp->tx_ring[i].ah)
1686 ib_destroy_ah(tun_qp->tx_ring[i].ah);
1688 kfree(tun_qp->tx_ring);
1689 kfree(tun_qp->ring);
1695 struct mlx4_ib_demux_pv_qp *tun_qp;
1702 tun_qp = &ctx->qp[MLX4_TUN_WRID_QPN(wc.wr_id)];
1707 ret = mlx4_ib_post_pv_qp_buf(ctx, tun_qp,
1718 ib_destroy_ah(tun_qp->tx_ring[wc.wr_id &
1720 tun_qp->tx_ring[wc.wr_id & (MLX4_NUM_TUNNEL_BUFS - 1)].ah
1722 spin_lock(&tun_qp->tx_lock);
1723 tun_qp->tx_ix_tail++;
1724 spin_unlock(&tun_qp->tx_lock);
1735 ib_destroy_ah(tun_qp->tx_ring[wc.wr_id &
1737 tun_qp->tx_ring[wc.wr_id & (MLX4_NUM_TUNNEL_BUFS - 1)].ah
1739 spin_lock(&tun_qp->tx_lock);
1740 tun_qp->tx_ix_tail++;
1741 spin_unlock(&tun_qp->tx_lock);
1760 struct mlx4_ib_demux_pv_qp *tun_qp;
1768 tun_qp = &ctx->qp[qp_type];
1796 tun_qp->qp = ib_create_qp(ctx->pd, &qp_init_attr.init_attr);
1797 if (IS_ERR(tun_qp->qp)) {
1798 ret = PTR_ERR(tun_qp->qp);
1799 tun_qp->qp = NULL;
1817 ret = ib_modify_qp(tun_qp->qp, &attr, qp_attr_mask_INIT);
1824 ret = ib_modify_qp(tun_qp->qp, &attr, IB_QP_STATE);
1832 ret = ib_modify_qp(tun_qp->qp, &attr, IB_QP_STATE | IB_QP_SQ_PSN);
1840 ret = mlx4_ib_post_pv_qp_buf(ctx, tun_qp, i);
1850 ib_destroy_qp(tun_qp->qp);
1851 tun_qp->qp = NULL;