static ssize_t mlxm_ep_cancel(fid_t fid, void *ctx) { struct mlxm_fid_ep *fid_ep; struct mlxm_req *req; struct fi_context *context = (struct fi_context*)ctx; int err; fid_ep = container_of(fid, struct mlxm_fid_ep, ep.fid); if (!fid_ep->domain) return -EBADF; if (!context) return -EINVAL; if (context->internal[1] == NULL) return -FI_EINVAL; req =(struct mlxm_req *)context->internal[1]; if (FI_RECV == (uint64_t)(context->internal[3])) { err = mxm_req_cancel_recv(&req->mxm_req.rreq); } else { err = mxm_req_cancel_send(&req->mxm_req.sreq); } if (err == MXM_OK) { mxm_req_wait(&req->mxm_req.rreq.base); } return mlxm_errno(err); }
int ompi_mtl_mxm_cancel(struct mca_mtl_base_module_t* mtl, struct mca_mtl_request_t *mtl_request, int flag) { mca_mtl_mxm_request_t *mtl_mxm_request = (mca_mtl_mxm_request_t*) mtl_request; mxm_error_t err; #if MXM_API >= MXM_VERSION(2,0) if (mtl_mxm_request->is_send) { err = mxm_req_cancel_send(&mtl_mxm_request->mxm.send); } else { err = mxm_req_cancel_recv(&mtl_mxm_request->mxm.recv); } #else err = mxm_req_cancel(&mtl_mxm_request->mxm.base); #endif if ((err != MXM_OK) && (err != MXM_ERR_NO_PROGRESS)) { return OMPI_ERROR; } return OMPI_SUCCESS; }
static int mca_pml_yalla_send_request_cancel(ompi_request_t *request, int flag) { mca_pml_yalla_send_request_t *sreq = (mca_pml_yalla_send_request_t*)request; mxm_error_t error; if (REQUEST_COMPLETE(request)) { /* * This might be a buffered send request which has completed anyway, so * we cannot cancel it anymore. Just hope for the best. */ PML_YALLA_VERBOSE(7, "not canceling a completed send request %p", (void *)request); return OMPI_SUCCESS; } error = mxm_req_cancel_send(&sreq->mxm); if ((error != MXM_OK) && (error != MXM_ERR_NO_PROGRESS)) { PML_YALLA_ERROR("failed to cancel send request %p: %s", (void *)request, mxm_error_string(error)); return OMPI_ERROR; } PML_YALLA_VERBOSE(9, "canceled send request %p", (void *)request); return OMPI_SUCCESS; }