--- initial
+++ final
@@ -1,116 +1,116 @@
 int mlx4_ib_send_to_slave(struct mlx4_ib_dev *dev, int slave, u8 port, enum ib_qp_type dest_qpt, struct ib_wc *wc, struct ib_grh *grh, struct ib_mad *mad) {
   struct ib_sge list;
   struct ib_ud_wr wr;
   struct ib_send_wr *bad_wr;
   struct mlx4_ib_demux_pv_ctx *tun_ctx;
   struct mlx4_ib_demux_pv_qp *tun_qp;
   struct mlx4_rcv_tunnel_mad *tun_mad;
   struct rdma_ah_attr attr;
   struct ib_ah *ah;
   struct ib_qp *src_qp = NULL;
   unsigned tun_tx_ix = 0;
   int dqpn;
   int ret = 0;
   u16 tun_pkey_ix;
   u16 cached_pkey;
   u8 is_eth = dev->dev->caps.port_type[port] == MLX4_PORT_TYPE_ETH;
   if (dest_qpt > IB_QPT_GSI) return -EINVAL;
   tun_ctx = dev->sriov.demux[port - 1].tun[slave];
   /* check if proxy qp created */
   if (!tun_ctx || tun_ctx->state != DEMUX_PV_STATE_ACTIVE) return -EAGAIN;
   if (!dest_qpt)
     tun_qp = &tun_ctx->qp[0];
   else
     tun_qp = &tun_ctx->qp[1];
   /* compute P_Key index to put in tunnel header for slave */
   if (dest_qpt) {
     u16 pkey_ix;
     ret = ib_get_cached_pkey(&dev->ib_dev, port, wc->pkey_index, &cached_pkey);
     if (ret) return -EINVAL;
     ret = find_slave_port_pkey_ix(dev, slave, port, cached_pkey, &pkey_ix);
     if (ret) return -EINVAL;
     tun_pkey_ix = pkey_ix;
   } else
     tun_pkey_ix = dev->pkeys.virt2phys_pkey[slave][port - 1][0];
   dqpn = dev->dev->phys_caps.base_proxy_sqpn + 8 * slave + port + (dest_qpt * 2) - 1;
   /* get tunnel tx data buf for slave */
   src_qp = tun_qp->qp;
   /* create ah. Just need an empty one with the port num for the post send.
    * The driver will set the force loopback bit in post_send */
   memset(&attr, 0, sizeof attr);
   attr.port_num = port;
   if (is_eth) {
     union ib_gid sgid;
     if (get_gids_from_l3_hdr(grh, &sgid, &attr.grh.dgid)) return -EINVAL;
     attr.ah_flags = IB_AH_GRH;
   }
   ah = rdma_create_ah(tun_ctx->pd, &attr);
   if (IS_ERR(ah)) return -ENOMEM;
   /* allocate tunnel tx buf after pass failure returns */
   spin_lock(&tun_qp->tx_lock);
   if (tun_qp->tx_ix_head - tun_qp->tx_ix_tail >= (MLX4_NUM_TUNNEL_BUFS - 1))
     ret = -EAGAIN;
   else
     tun_tx_ix = (++tun_qp->tx_ix_head) & (MLX4_NUM_TUNNEL_BUFS - 1);
   spin_unlock(&tun_qp->tx_lock);
   if (ret) goto end;
   tun_mad = (struct mlx4_rcv_tunnel_mad *)(tun_qp->tx_ring[tun_tx_ix].buf.addr);
   if (tun_qp->tx_ring[tun_tx_ix].ah) ib_destroy_ah(tun_qp->tx_ring[tun_tx_ix].ah);
   tun_qp->tx_ring[tun_tx_ix].ah = ah;
   ib_dma_sync_single_for_cpu(&dev->ib_dev, tun_qp->tx_ring[tun_tx_ix].buf.map, sizeof(struct mlx4_rcv_tunnel_mad), DMA_TO_DEVICE);
   /* copy over to tunnel buffer */
   if (grh) memcpy(&tun_mad->grh, grh, sizeof *grh);
   memcpy(&tun_mad->mad, mad, sizeof *mad);
   /* adjust tunnel data */
   tun_mad->hdr.pkey_index = cpu_to_be16(tun_pkey_ix);
   tun_mad->hdr.flags_src_qp = cpu_to_be32(wc->src_qp & 0xFFFFFF);
   tun_mad->hdr.g_ml_path = (grh && (wc->wc_flags & IB_WC_GRH)) ? 0x80 : 0;
   if (is_eth) {
     u16 vlan = 0;
     if (mlx4_get_slave_default_vlan(dev->dev, port, slave, &vlan, NULL)) {
       /* VST mode */
       if (vlan != wc->vlan_id)
         /* Packet vlan is not the VST-assigned vlan.
          * Drop the packet.
          */
         goto out;
       else
         /* Remove the vlan tag before forwarding
          * the packet to the VF.
          */
         vlan = 0xffff;
     } else {
       vlan = wc->vlan_id;
     }
     tun_mad->hdr.sl_vid = cpu_to_be16(vlan);
     memcpy((char *)&tun_mad->hdr.mac_31_0, &(wc->smac[0]), 4);
     memcpy((char *)&tun_mad->hdr.slid_mac_47_32, &(wc->smac[4]), 2);
   } else {
     tun_mad->hdr.sl_vid = cpu_to_be16(((u16)(wc->sl)) << 12);
     tun_mad->hdr.slid_mac_47_32 = cpu_to_be16(wc->slid);
   }
   ib_dma_sync_single_for_device(&dev->ib_dev, tun_qp->tx_ring[tun_tx_ix].buf.map, sizeof(struct mlx4_rcv_tunnel_mad), DMA_TO_DEVICE);
   list.addr = tun_qp->tx_ring[tun_tx_ix].buf.map;
   list.length = sizeof(struct mlx4_rcv_tunnel_mad);
   list.lkey = tun_ctx->pd->local_dma_lkey;
   wr.ah = ah;
   wr.port_num = port;
   wr.remote_qkey = IB_QP_SET_QKEY;
   wr.remote_qpn = dqpn;
   wr.wr.next = NULL;
   wr.wr.wr_id = ((u64)tun_tx_ix) | MLX4_TUN_SET_WRID_QPN(dest_qpt);
   wr.wr.sg_list = &list;
   wr.wr.num_sge = 1;
   wr.wr.opcode = IB_WR_SEND;
   wr.wr.send_flags = IB_SEND_SIGNALED;
   ret = ib_post_send(src_qp, &wr.wr, &bad_wr);
   if (!ret) return 0;
 out:
   spin_lock(&tun_qp->tx_lock);
   tun_qp->tx_ix_tail++;
   spin_unlock(&tun_qp->tx_lock);
   tun_qp->tx_ring[tun_tx_ix].ah = NULL;
 end:
-  ib_destroy_ah(ah);
+  rdma_destroy_ah(ah);
   return ret;
 }<sep>@@
expression ad;
@@

-       ib_destroy_ah
+       rdma_destroy_ah
	(ah)