static void rxd_handle_conn_req(struct rxd_ep *ep, struct ofi_ctrl_hdr *ctrl, struct fi_cq_msg_entry *comp, struct rxd_rx_buf *rx_buf) { struct rxd_pkt_data *pkt_data; struct rxd_peer *peer_info; fi_addr_t dg_fiaddr; void *addr; int ret; FI_INFO(&rxd_prov, FI_LOG_EP_DATA, "conn req - rx_key: %" PRIu64 "\n", ctrl->rx_key); pkt_data = (struct rxd_pkt_data *) ctrl; addr = pkt_data->data; if (ctrl->seg_size > RXD_MAX_DGRAM_ADDR) { FI_WARN(&rxd_prov, FI_LOG_EP_DATA, "addr too large\n"); goto repost; } ret = rxd_av_insert_dg_addr(rxd_ep_av(ep), ctrl->rx_key, addr, &dg_fiaddr); if (ret) { FI_WARN(&rxd_prov, FI_LOG_EP_DATA, "failed to insert peer address\n"); goto repost; } peer_info = rxd_ep_getpeer_info(ep, dg_fiaddr); if (peer_info->state != CMAP_CONNECTED) { peer_info->state = CMAP_CONNECTED; peer_info->conn_data = ctrl->conn_id; peer_info->exp_msg_id++; } rxd_ep_reply_ack(ep, ctrl, ofi_ctrl_connresp, 0, ctrl->conn_id, dg_fiaddr, dg_fiaddr); repost: rxd_ep_repost_buff(rx_buf); }
static int rxd_av_insert(struct fid_av *av_fid, const void *addr, size_t count, fi_addr_t *fi_addr, uint64_t flags, void *context) { struct rxd_av *av; int i = 0, ret = 0, success_cnt = 0; fi_addr_t rxd_addr, util_addr; struct ofi_rbnode *node; av = container_of(av_fid, struct rxd_av, util_av.av_fid); fastlock_acquire(&av->util_av.lock); if (!av->dg_addrlen) { ret = rxd_av_set_addrlen(av, addr); if (ret) goto out; } for (; i < count; i++, addr = (uint8_t *) addr + av->dg_addrlen) { node = ofi_rbmap_find(&av->rbmap, (void *) addr); if (node) { rxd_addr = (fi_addr_t) node->data; } else { ret = rxd_av_insert_dg_addr(av, addr, &rxd_addr, flags, context); if (ret) break; } util_addr = av->rxd_addr_table[rxd_addr].fi_addr == FI_ADDR_UNSPEC ? rxd_set_fi_addr(av, rxd_addr) : av->rxd_addr_table[rxd_addr].fi_addr; if (fi_addr) fi_addr[i] = util_addr; success_cnt++; } if (ret) { FI_WARN(&rxd_prov, FI_LOG_AV, "failed to insert address %d: %d (%s)\n", i, -ret, fi_strerror(-ret)); if (av->util_av.eq) ofi_av_write_event(&av->util_av, i, -ret, context); if (fi_addr) fi_addr[i] = FI_ADDR_NOTAVAIL; i++; } out: av->dg_av_used += success_cnt; fastlock_release(&av->util_av.lock); for (; i < count; i++) { if (av->util_av.eq) ofi_av_write_event(&av->util_av, i, FI_ECANCELED, context); if (fi_addr) fi_addr[i] = FI_ADDR_NOTAVAIL; } if (av->util_av.eq) { ofi_av_write_event(&av->util_av, success_cnt, 0, context); return 0; } return success_cnt; }