void process_tx_entry(struct tcpx_xfer_entry *tx_entry) { struct tcpx_cq *tcpx_cq; int ret; ret = tcpx_send_msg(tx_entry); if (OFI_SOCK_TRY_SND_RCV_AGAIN(-ret)) return; if (!ret) goto done; FI_WARN(&tcpx_prov, FI_LOG_DOMAIN, "msg send failed\n"); if (ret == -FI_ENOTCONN) tcpx_ep_shutdown_report(tx_entry->ep, &tx_entry->ep->util_ep.ep_fid.fid); done: tcpx_cq_report_completion(tx_entry->ep->util_ep.tx_cq, tx_entry, -ret); slist_remove_head(&tx_entry->ep->tx_queue); if (ntohl(tx_entry->msg_hdr.hdr.flags) & (OFI_DELIVERY_COMPLETE | OFI_COMMIT_COMPLETE)) { tx_entry->flags |= FI_COMPLETION; slist_insert_tail(&tx_entry->entry, &tx_entry->ep->tx_rsp_pend_queue); return; } tcpx_cq = container_of(tx_entry->ep->util_ep.tx_cq, struct tcpx_cq, util_cq); tcpx_xfer_entry_release(tcpx_cq, tx_entry); }
static void process_tx_entry(struct tcpx_xfer_entry *tx_entry) { struct tcpx_cq *tcpx_cq; int ret; ret = tcpx_send_msg(tx_entry); if (OFI_SOCK_TRY_SND_RCV_AGAIN(-ret)) return; /* Keep this path below as a single pass path.*/ tx_entry->ep->hdr_bswap(&tx_entry->hdr.base_hdr); slist_remove_head(&tx_entry->ep->tx_queue); if (ret) { FI_WARN(&tcpx_prov, FI_LOG_DOMAIN, "msg send failed\n"); tcpx_ep_shutdown_report(tx_entry->ep, &tx_entry->ep->util_ep.ep_fid.fid); tcpx_cq_report_error(tx_entry->ep->util_ep.tx_cq, tx_entry, ret); } else { tcpx_cq_report_success(tx_entry->ep->util_ep.tx_cq, tx_entry); if (tx_entry->hdr.base_hdr.flags & (OFI_DELIVERY_COMPLETE | OFI_COMMIT_COMPLETE)) { tx_entry->flags |= FI_COMPLETION; slist_insert_tail(&tx_entry->entry, &tx_entry->ep->tx_rsp_pend_queue); return; } } tcpx_cq = container_of(tx_entry->ep->util_ep.tx_cq, struct tcpx_cq, util_cq); tcpx_xfer_entry_release(tcpx_cq, tx_entry); }
static int process_rx_read_entry(struct tcpx_xfer_entry *rx_entry) { struct tcpx_cq *tcpx_cq; int ret; ret = tcpx_recv_msg_data(rx_entry); if (OFI_SOCK_TRY_SND_RCV_AGAIN(-ret)) return ret; if (!ret) goto done; FI_WARN(&tcpx_prov, FI_LOG_DOMAIN, "msg recv Failed ret = %d\n", ret); if (ret == -FI_ENOTCONN) tcpx_ep_shutdown_report(rx_entry->ep, &rx_entry->ep->util_ep.ep_fid.fid); done: tcpx_cq_report_completion(rx_entry->ep->util_ep.tx_cq, rx_entry, -ret); slist_remove_head(&rx_entry->ep->rma_read_queue); tcpx_cq = container_of(rx_entry->ep->util_ep.tx_cq, struct tcpx_cq, util_cq); tcpx_xfer_entry_release(tcpx_cq, rx_entry); return FI_SUCCESS; }
static int process_rx_entry(struct tcpx_xfer_entry *rx_entry) { struct tcpx_cq *tcpx_cq; int ret; ret = tcpx_recv_msg_data(rx_entry); if (OFI_SOCK_TRY_SND_RCV_AGAIN(-ret)) return ret; if (!ret) goto done; FI_WARN(&tcpx_prov, FI_LOG_DOMAIN, "msg recv Failed ret = %d\n", ret); if (ret == -FI_ENOTCONN) tcpx_ep_shutdown_report(rx_entry->ep, &rx_entry->ep->util_ep.ep_fid.fid); done: if (ntohl(rx_entry->msg_hdr.hdr.flags) & OFI_DELIVERY_COMPLETE) { if (tcpx_prepare_rx_entry_resp(rx_entry)) rx_entry->ep->cur_rx_proc_fn = tcpx_prepare_rx_entry_resp; return FI_SUCCESS; } tcpx_cq_report_completion(rx_entry->ep->util_ep.rx_cq, rx_entry, -ret); tcpx_cq = container_of(rx_entry->ep->util_ep.rx_cq, struct tcpx_cq, util_cq); tcpx_xfer_entry_release(tcpx_cq, rx_entry); return FI_SUCCESS; }
static int process_rx_entry(struct tcpx_xfer_entry *rx_entry) { int ret = FI_SUCCESS; ret = tcpx_recv_msg_data(rx_entry); if (OFI_SOCK_TRY_SND_RCV_AGAIN(-ret)) return ret; if (ret) { FI_WARN(&tcpx_prov, FI_LOG_EP_DATA, "msg recv Failed ret = %d\n", ret); tcpx_ep_shutdown_report(rx_entry->ep, &rx_entry->ep->util_ep.ep_fid.fid); tcpx_cq_report_error(rx_entry->ep->util_ep.rx_cq, rx_entry, ret); tcpx_rx_msg_release(rx_entry); } else if (rx_entry->hdr.base_hdr.flags & OFI_DELIVERY_COMPLETE) { if (tcpx_prepare_rx_entry_resp(rx_entry)) rx_entry->ep->cur_rx_proc_fn = tcpx_prepare_rx_entry_resp; } else { tcpx_cq_report_success(rx_entry->ep->util_ep.rx_cq, rx_entry); tcpx_rx_msg_release(rx_entry); } return ret; }
static void process_rx_pe_entry(struct tcpx_pe_entry *pe_entry) { int ret; ret = tcpx_recv_msg(pe_entry); if (OFI_SOCK_TRY_SND_RCV_AGAIN(-ret)) return; if (ret) { FI_WARN(&tcpx_prov, FI_LOG_DOMAIN, "msg recv Failed ret = %d\n", ret); report_pe_entry_completion(pe_entry, ret); pe_entry_release(pe_entry); return; } if (pe_entry->done_len && pe_entry->done_len == ntohll(pe_entry->msg_hdr.size)) { report_pe_entry_completion(pe_entry, 0); pe_entry_release(pe_entry); } }
static void process_tx_pe_entry(struct tcpx_pe_entry *pe_entry) { uint64_t total_len = ntohll(pe_entry->msg_hdr.size); int ret; ret = tcpx_send_msg(pe_entry); if (OFI_SOCK_TRY_SND_RCV_AGAIN(-ret)) return; if (ret) { FI_WARN(&tcpx_prov, FI_LOG_DOMAIN, "msg send failed\n"); report_pe_entry_completion(pe_entry, ret); pe_entry_release(pe_entry); return; } if (pe_entry->done_len == total_len) { report_pe_entry_completion(pe_entry, 0); pe_entry_release(pe_entry); } }
static int process_rx_remote_write_entry(struct tcpx_xfer_entry *rx_entry) { struct tcpx_cq *tcpx_cq; int ret = FI_SUCCESS; ret = tcpx_recv_msg_data(rx_entry); if (OFI_SOCK_TRY_SND_RCV_AGAIN(-ret)) return ret; if (ret) { FI_WARN(&tcpx_prov, FI_LOG_DOMAIN, "remote write Failed ret = %d\n", ret); tcpx_ep_shutdown_report(rx_entry->ep, &rx_entry->ep->util_ep.ep_fid.fid); tcpx_cq_report_error(rx_entry->ep->util_ep.rx_cq, rx_entry, ret); tcpx_cq = container_of(rx_entry->ep->util_ep.rx_cq, struct tcpx_cq, util_cq); tcpx_xfer_entry_release(tcpx_cq, rx_entry); } else if (rx_entry->hdr.base_hdr.flags &
static ssize_t sock_comm_send_socket(struct sock_conn *conn, const void *buf, size_t len) { ssize_t ret; ret = ofi_send_socket(conn->sock_fd, buf, len, MSG_NOSIGNAL); if (ret < 0) { if (OFI_SOCK_TRY_SND_RCV_AGAIN(ofi_sockerr())) { ret = 0; } else if (ofi_sockerr() == EPIPE) { conn->connected = 0; SOCK_LOG_DBG("Disconnected: %s:%d\n", inet_ntoa(conn->addr.sin_addr), ntohs(conn->addr.sin_port)); } else { SOCK_LOG_DBG("write error: %s\n", strerror(ofi_sockerr())); } } if (ret > 0) SOCK_LOG_DBG("wrote to network: %lu\n", ret); return ret; }
static int process_srx_entry(struct tcpx_xfer_entry *rx_entry) { int ret; ret = tcpx_recv_msg_data(rx_entry); if (OFI_SOCK_TRY_SND_RCV_AGAIN(-ret)) return ret; if (ret) { FI_WARN(&tcpx_prov, FI_LOG_DOMAIN, "msg recv Failed ret = %d\n", ret); tcpx_ep_shutdown_report(rx_entry->ep, &rx_entry->ep->util_ep.ep_fid.fid); } if ((ntohl(rx_entry->msg_hdr.hdr.flags) & OFI_DELIVERY_COMPLETE) && !ret) { if (tcpx_prepare_rx_entry_resp(rx_entry)) rx_entry->ep->cur_rx_proc_fn = tcpx_prepare_rx_entry_resp; return FI_SUCCESS; } tcpx_cq_report_completion(rx_entry->ep->util_ep.rx_cq, rx_entry, -ret); /* release the shared entry */ if (rx_entry->ep->cur_rx_entry == rx_entry) { rx_entry->ep->cur_rx_entry = NULL; } fastlock_acquire(&rx_entry->ep->srx_ctx->lock); util_buf_release(rx_entry->ep->srx_ctx->buf_pool, rx_entry); fastlock_release(&rx_entry->ep->srx_ctx->lock); return FI_SUCCESS; }