1 /*
2 * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
3 * University Research and Technology
4 * Corporation. All rights reserved.
5 * Copyright (c) 2004-2005 The University of Tennessee and The University
6 * of Tennessee Research Foundation. All rights
7 * reserved.
8 * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
9 * University of Stuttgart. All rights reserved.
10 * Copyright (c) 2004-2006 The Regents of the University of California.
11 * All rights reserved.
12 * Copyright (c) 2006 QLogic Corporation. All rights reserved.
13 * $COPYRIGHT$
14 *
15 * Additional copyrights may follow
16 *
17 * $HEADER$
18 */
19
20 #include "ompi_config.h"
21 #include "mtl_psm.h"
22 #include "mtl_psm_request.h"
23
24 int ompi_mtl_psm_cancel(struct mca_mtl_base_module_t* mtl,
25 struct mca_mtl_request_t *mtl_request,
26 int flag) {
27
28 psm_error_t err;
29 psm_mq_status_t status;
30
31 mca_mtl_psm_request_t *mtl_psm_request =
32 (mca_mtl_psm_request_t*) mtl_request;
33
34 /* PSM does not support canceling sends */
35 if(OMPI_MTL_PSM_ISEND == mtl_psm_request->type) {
36 return OMPI_SUCCESS;
37 }
38
39 err = psm_mq_cancel(&mtl_psm_request->psm_request);
40 if(PSM_OK == err) {
41 err = psm_mq_test(&mtl_psm_request->psm_request, &status);
42 if(PSM_OK == err) {
43 mtl_request->ompi_req->req_status._cancelled = true;
44 mtl_psm_request->super.completion_callback(&mtl_psm_request->super);
45 return OMPI_SUCCESS;
46 } else {
47 return OMPI_ERROR;
48 }
49 } else if(PSM_MQ_INCOMPLETE == err) {
50 return OMPI_SUCCESS;
51 }
52
53 return OMPI_ERROR;
54 }