if (qp->ibqp.qp_type == IB_QPT_UD ||
                            qp->ibqp.qp_type == IB_QPT_SMI ||
                            qp->ibqp.qp_type == IB_QPT_GSI)
-                               atomic_dec(&to_iah(wqe->ud_wr.ah)->refcount);
+                               atomic_dec(&ibah_to_rvtah(wqe->ud_wr.ah)->refcount);
                        if (++qp->s_last >= qp->s_size)
                                qp->s_last = 0;
                }
 
                if (attr->ah_attr.dlid >= be16_to_cpu(IB_MULTICAST_LID_BASE))
                        goto inval;
-               if (hfi1_check_ah(qp->ibqp.device, &attr->ah_attr))
+               if (rvt_check_ah(qp->ibqp.device, &attr->ah_attr))
                        goto inval;
                sc = ah_to_sc(ibqp->device, &attr->ah_attr);
                if (!qp_to_sdma_engine(qp, sc) &&
                if (attr->alt_ah_attr.dlid >=
                    be16_to_cpu(IB_MULTICAST_LID_BASE))
                        goto inval;
-               if (hfi1_check_ah(qp->ibqp.device, &attr->alt_ah_attr))
+               if (rvt_check_ah(qp->ibqp.device, &attr->alt_ah_attr))
                        goto inval;
                if (attr->alt_pkey_index >= hfi1_get_npkeys(dd))
                        goto inval;
 
                if (wqe->length > 0x80000000U)
                        goto bail_inval_free;
        } else {
-               struct hfi1_ah *ah = to_iah(ud_wr(wr)->ah);
-
-               atomic_inc(&ah->refcount);
+               atomic_inc(&ibah_to_rvtah(ud_wr(wr)->ah)->refcount);
        }
        wqe->ssn = qp->s_ssn++;
        qp->s_head = next;
        return ibp->sl_to_sc[ah->sl];
 }
 
-int hfi1_check_ah(struct ib_device *ibdev, struct ib_ah_attr *ah_attr)
+static int hfi1_check_ah(struct ib_device *ibdev, struct ib_ah_attr *ah_attr)
 {
        struct hfi1_ibport *ibp;
        struct hfi1_pportdata *ppd;
        struct hfi1_devdata *dd;
        u8 sc5;
 
-       /* A multicast address requires a GRH (see ch. 8.4.1). */
-       if (ah_attr->dlid >= HFI1_MULTICAST_LID_BASE &&
-           ah_attr->dlid != HFI1_PERMISSIVE_LID &&
-           !(ah_attr->ah_flags & IB_AH_GRH))
-               goto bail;
-       if ((ah_attr->ah_flags & IB_AH_GRH) &&
-           ah_attr->grh.sgid_index >= HFI1_GUIDS_PER_PORT)
-               goto bail;
-       if (ah_attr->dlid == 0)
-               goto bail;
-       if (ah_attr->port_num < 1 ||
-           ah_attr->port_num > ibdev->phys_port_cnt)
-               goto bail;
-       if (ah_attr->static_rate != IB_RATE_PORT_CURRENT &&
-           ib_rate_to_mbps(ah_attr->static_rate) < 0)
-               goto bail;
-       if (ah_attr->sl >= OPA_MAX_SLS)
-               goto bail;
        /* test the mapping for validity */
        ibp = to_iport(ibdev, ah_attr->port_num);
        ppd = ppd_from_ibp(ibp);
        sc5 = ibp->sl_to_sc[ah_attr->sl];
        dd = dd_from_ppd(ppd);
        if (sc_to_vlt(dd, sc5) > num_vls && sc_to_vlt(dd, sc5) != 0xf)
-               goto bail;
+               return -EINVAL;
        return 0;
-bail:
-       return -EINVAL;
-}
-
-/**
- * create_ah - create an address handle
- * @pd: the protection domain
- * @ah_attr: the attributes of the AH
- *
- * This may be called from interrupt context.
- */
-static struct ib_ah *create_ah(struct ib_pd *pd,
-                              struct ib_ah_attr *ah_attr)
-{
-       struct hfi1_ah *ah;
-       struct ib_ah *ret;
-       struct hfi1_ibdev *dev = to_idev(pd->device);
-       unsigned long flags;
-
-       if (hfi1_check_ah(pd->device, ah_attr)) {
-               ret = ERR_PTR(-EINVAL);
-               goto bail;
-       }
-
-       ah = kmalloc(sizeof(*ah), GFP_ATOMIC);
-       if (!ah) {
-               ret = ERR_PTR(-ENOMEM);
-               goto bail;
-       }
-
-       spin_lock_irqsave(&dev->n_ahs_lock, flags);
-       if (dev->n_ahs_allocated == hfi1_max_ahs) {
-               spin_unlock_irqrestore(&dev->n_ahs_lock, flags);
-               kfree(ah);
-               ret = ERR_PTR(-ENOMEM);
-               goto bail;
-       }
-
-       dev->n_ahs_allocated++;
-       spin_unlock_irqrestore(&dev->n_ahs_lock, flags);
-
-       /* ib_create_ah() will initialize ah->ibah. */
-       ah->attr = *ah_attr;
-       atomic_set(&ah->refcount, 0);
-
-       ret = &ah->ibah;
-
-bail:
-       return ret;
 }
 
 struct ib_ah *hfi1_create_qp0_ah(struct hfi1_ibport *ibp, u16 dlid)
        return ah;
 }
 
-/**
- * destroy_ah - destroy an address handle
- * @ibah: the AH to destroy
- *
- * This may be called from interrupt context.
- */
-static int destroy_ah(struct ib_ah *ibah)
-{
-       struct hfi1_ibdev *dev = to_idev(ibah->device);
-       struct hfi1_ah *ah = to_iah(ibah);
-       unsigned long flags;
-
-       if (atomic_read(&ah->refcount) != 0)
-               return -EBUSY;
-
-       spin_lock_irqsave(&dev->n_ahs_lock, flags);
-       dev->n_ahs_allocated--;
-       spin_unlock_irqrestore(&dev->n_ahs_lock, flags);
-
-       kfree(ah);
-
-       return 0;
-}
-
-static int modify_ah(struct ib_ah *ibah, struct ib_ah_attr *ah_attr)
-{
-       struct hfi1_ah *ah = to_iah(ibah);
-
-       if (hfi1_check_ah(ibah->device, ah_attr))
-               return -EINVAL;
-
-       ah->attr = *ah_attr;
-
-       return 0;
-}
-
-static int query_ah(struct ib_ah *ibah, struct ib_ah_attr *ah_attr)
-{
-       struct hfi1_ah *ah = to_iah(ibah);
-
-       *ah_attr = ah->attr;
-
-       return 0;
-}
-
 /**
  * hfi1_get_npkeys - return the size of the PKEY table for context 0
  * @dd: the hfi1_ib device
 
        /* Only need to initialize non-zero fields. */
 
-       spin_lock_init(&dev->n_ahs_lock);
        spin_lock_init(&dev->n_cqs_lock);
        spin_lock_init(&dev->n_qps_lock);
        spin_lock_init(&dev->n_srqs_lock);
        ibdev->dealloc_ucontext = dealloc_ucontext;
        ibdev->alloc_pd = NULL;
        ibdev->dealloc_pd = NULL;
-       ibdev->create_ah = create_ah;
-       ibdev->destroy_ah = destroy_ah;
-       ibdev->modify_ah = modify_ah;
-       ibdev->query_ah = query_ah;
+       ibdev->create_ah = NULL;
+       ibdev->destroy_ah = NULL;
+       ibdev->modify_ah = NULL;
+       ibdev->query_ah = NULL;
        ibdev->create_srq = hfi1_create_srq;
        ibdev->modify_srq = hfi1_modify_srq;
        ibdev->query_srq = hfi1_query_srq;
        dd->verbs_dev.rdi.driver_f.port_callback = hfi1_create_port_files;
        dd->verbs_dev.rdi.driver_f.get_card_name = get_card_name;
        dd->verbs_dev.rdi.driver_f.get_pci_dev = get_pci_dev;
+       dd->verbs_dev.rdi.driver_f.check_ah = hfi1_check_ah;
+       dd->verbs_dev.rdi.dparms.props.max_ah = hfi1_max_ahs;
        dd->verbs_dev.rdi.dparms.props.max_pd = hfi1_max_pds;
        dd->verbs_dev.rdi.flags = (RVT_FLAG_MR_INIT_DRIVER |
                                   RVT_FLAG_QP_INIT_DRIVER |
 
        int n_attached;
 };
 
-/* Address Handle */
-struct hfi1_ah {
-       struct ib_ah ibah;
-       struct ib_ah_attr attr;
-       atomic_t refcount;
-};
-
 /*
  * This structure is used by hfi1_mmap() to validate an offset
  * when an mmap() request is made.  The vm_area_struct then uses
 struct hfi1_ibport {
        struct hfi1_qp __rcu *qp[2];
        struct ib_mad_agent *send_agent;        /* agent for SMI (traps) */
-       struct hfi1_ah *sm_ah;
-       struct hfi1_ah *smi_ah;
+       struct rvt_ah *sm_ah;
+       struct rvt_ah *smi_ah;
        struct rb_root mcast_tree;
        spinlock_t lock;                /* protect changes in this struct */
 
        u64 n_kmem_wait;
        u64 n_send_schedule;
 
-       u32 n_ahs_allocated;    /* number of AHs allocated for device */
-       spinlock_t n_ahs_lock;
        u32 n_cqs_allocated;    /* number of CQs allocated for device */
        spinlock_t n_cqs_lock;
        u32 n_qps_allocated;    /* number of QPs allocated for device */
        return container_of(ibmr, struct hfi1_mr, ibmr);
 }
 
-static inline struct hfi1_ah *to_iah(struct ib_ah *ibah)
-{
-       return container_of(ibah, struct hfi1_ah, ibah);
-}
-
 static inline struct hfi1_cq *to_icq(struct ib_cq *ibcq)
 {
        return container_of(ibcq, struct hfi1_cq, ibcq);
 
 u8 ah_to_sc(struct ib_device *ibdev, struct ib_ah_attr *ah_attr);
 
-int hfi1_check_ah(struct ib_device *ibdev, struct ib_ah_attr *ah_attr);
-
 struct ib_ah *hfi1_create_qp0_ah(struct hfi1_ibport *ibp, u16 dlid);
 
 void hfi1_rc_rnr_retry(unsigned long arg);