> Subject: Re: [PATCH rdma-next] RDMA/irdma: Add support for address handle re- > use > > On Thu, Jan 20, 2022 at 11:40:41AM -0600, Shiraz Saleem wrote: > > +/** > > + * irdma_ah_exists - Check for existing identical AH > > + * @iwdev: irdma device > > + * @new_ah: AH to check for > > + * > > + * returns true if AH is found, false if not found. > > + */ > > +static bool irdma_ah_exists(struct irdma_device *iwdev, > > + struct irdma_ah *new_ah) > > +{ > > + struct irdma_ah *ah; > > > > - if (!cnt) { > > - ibdev_dbg(&iwdev->ibdev, > > - "VERBS: CQP create AH timed out"); > > - err = -ETIMEDOUT; > > - goto error; > > + list_for_each_entry (ah, &iwdev->ah_list, list) { > > + /* Set ah_valid and ah_id the same so memcmp can work */ > > + new_ah->sc_ah.ah_info.ah_idx = ah->sc_ah.ah_info.ah_idx; > > + new_ah->sc_ah.ah_info.ah_valid = ah->sc_ah.ah_info.ah_valid; > > + if (!memcmp(&ah->sc_ah.ah_info, &new_ah->sc_ah.ah_info, > > + sizeof(ah->sc_ah.ah_info))) { > > + refcount_inc(&ah->refcnt); > > + new_ah->parent_ah = ah; > > + return true; > > } > > } > > So, the number of AHs is so large the HW has problems but you propose to use a > linear search to de-dup them? We will look into optimizing this search. > > > +static int irdma_create_user_ah(struct ib_ah *ibah, > > + struct rdma_ah_init_attr *attr, > > + struct ib_udata *udata) > > +{ > > + struct irdma_ah *ah = container_of(ibah, struct irdma_ah, ibah); > > + struct irdma_device *iwdev = to_iwdev(ibah->pd->device); > > + struct irdma_create_ah_resp uresp; > > + struct irdma_ah *parent_ah; > > + int err; > > + > > + err = irdma_setup_ah(ibah, attr); > > + if (err) > > + return err; > > + if (attr->flags & RDMA_CREATE_AH_SLEEPABLE) { > > + mutex_lock(&iwdev->ah_list_lock); > > User AH's are always sleepable, no need for these extra paths. > Ok. Thanks a lot for the feedback. Shiraz