fi_addr_t rxd_av_dg_addr(struct rxd_av *av, fi_addr_t fi_addr) { uint64_t *dg_idx; dg_idx = ofi_av_get_addr(&av->util_av, (int) fi_addr); return *dg_idx; }
int ofi_av_lookup_index(struct util_av *av, const void *addr, int slot) { int i, ret = -FI_ENODATA; if (slot < 0 || slot >= av->hash.slots) { FI_WARN(av->prov, FI_LOG_AV, "invalid slot (%d)\n", slot); return -FI_EINVAL; } fastlock_acquire(&av->lock); if (av->hash.table[slot].index == UTIL_NO_ENTRY) { FI_DBG(av->prov, FI_LOG_AV, "no entry at slot (%d)\n", slot); goto out; } for (i = slot; i != UTIL_NO_ENTRY; i = av->hash.table[i].next) { if (!memcmp(ofi_av_get_addr(av, av->hash.table[i].index), addr, av->addrlen)) { ret = av->hash.table[i].index; FI_DBG(av->prov, FI_LOG_AV, "entry at index (%d)\n", ret); break; } } out: FI_DBG(av->prov, FI_LOG_AV, "%d\n", ret); fastlock_release(&av->lock); return ret; }
static ssize_t mrail_tsend_common(struct fid_ep *ep_fid, const struct iovec *iov, void **desc, size_t count, size_t len, fi_addr_t dest_addr, uint64_t tag, uint64_t data, void *context, uint64_t flags) { struct mrail_ep *mrail_ep = container_of(ep_fid, struct mrail_ep, util_ep.ep_fid.fid); struct mrail_peer_info *peer_info; struct iovec *iov_dest = alloca(sizeof(*iov_dest) * (count + 1)); struct mrail_tx_buf *tx_buf; uint32_t i = mrail_get_tx_rail(mrail_ep); struct fi_msg msg; ssize_t ret; peer_info = ofi_av_get_addr(mrail_ep->util_ep.av, (int) dest_addr); ofi_ep_lock_acquire(&mrail_ep->util_ep); tx_buf = mrail_get_tx_buf(mrail_ep, context, peer_info->seq_no++, ofi_op_tagged, flags | FI_TAGGED); if (OFI_UNLIKELY(!tx_buf)) { ret = -FI_ENOMEM; goto err1; } tx_buf->hdr.tag = tag; mrail_copy_iov_hdr(&tx_buf->hdr, iov_dest, iov, count); msg.msg_iov = iov_dest; msg.desc = desc; msg.iov_count = count + 1; msg.addr = dest_addr; msg.context = tx_buf; msg.data = data; if (len < mrail_ep->rails[i].info->tx_attr->inject_size) flags |= FI_INJECT; FI_DBG(&mrail_prov, FI_LOG_EP_DATA, "Posting tsend of length: %" PRIu64 " dest_addr: 0x%" PRIx64 " tag: 0x%" PRIx64 " seq: %d" " on rail: %d\n", len, dest_addr, tag, peer_info->seq_no - 1, i); ret = fi_sendmsg(mrail_ep->rails[i].ep, &msg, flags); if (ret) { FI_WARN(&mrail_prov, FI_LOG_EP_DATA, "Unable to fi_sendmsg on rail: %" PRIu32 "\n", i); goto err2; } else if (!(flags & FI_COMPLETION)) { ofi_ep_tx_cntr_inc(&mrail_ep->util_ep); } ofi_ep_lock_release(&mrail_ep->util_ep); return ret; err2: util_buf_release(mrail_ep->tx_buf_pool, tx_buf); err1: peer_info->seq_no--; ofi_ep_lock_release(&mrail_ep->util_ep); return ret; }