1 /* 2 * Copyright (c) 2004-2007 The Trustees of the University of Tennessee. 3 * All rights reserved. 4 * $COPYRIGHT$ 5 * 6 * Additional copyrights may follow 7 * 8 * $HEADER$ 9 */ 10 11 #ifndef __INCLUDE_VPROTOCOL_REQUEST_H_ 12 #define __INCLUDE_VPROTOCOL_REQUEST_H_ 13 14 #include "ompi_config.h" 15 #include "ompi/mca/pml/base/pml_base_request.h" 16 #include "../vprotocol.h" 17 18 BEGIN_C_DECLS 19 20 21 /** Rebuild the PML requests pools to make room for extra space at end of each 22 * request. 23 * The extra data is allocated in each requests so that it can hold instances 24 * of the req_recv_class and req_send_class fields of the 25 * mca_vprotocol_base_module_t. If those fields are NULL the requests are not 26 * recreated. 27 * @return OMPI_SUCCESS or failure status 28 */ 29 OMPI_DECLSPEC int mca_vprotocol_base_request_parasite(void); 30 31 32 /** Gives the actual address of the protocol specific part of a recv request. 33 * @param req (IN) the address of an ompi_request. 34 * @return address of the custom vprotocol data associated with the request. 35 */ 36 #define VPROTOCOL_RECV_FTREQ(req) \ 37 (((uintptr_t) req) + mca_pml_v.host_pml_req_recv_size) 38 39 /** Gives the address of the real request associated with a protocol specific 40 * send request. 41 * @param ftreq (IN) the address of a protocol specific request. 42 * @return address of the associated ompi_request_t. 43 */ 44 #define VPROTOCOL_RECV_REQ(ftreq) \ 45 ((mca_pml_base_recv_request_t *) \ 46 (((uintptr_t) ftreq) - mca_pml_v.host_pml_req_send_size)) 47 48 /** Gives the actual address of the protocol specific part of a send request. 49 * @param req (IN) the address of an ompi_request. 50 * @return address of the custom vprotocol data associated with the request. 51 */ 52 #define VPROTOCOL_SEND_FTREQ(req) \ 53 (((uintptr_t) req) + mca_pml_v.host_pml_req_send_size) 54 55 /** Gives the address of the real request associated with a protocol specific 56 * send request. 57 * @param ftreq (IN) the address of a protocol specific request. 58 * @return address of the associated ompi_request_t. 59 */ 60 #define VPROTOCOL_SEND_REQ(ftreq) \ 61 ((mca_pml_base_send_request_t *) \ 62 (((uintptr_t) ftreq) - mca_pml_v.host_pml_req_send_size)) 63 64 /** Unified macro to get the actual address of the protocol specific part of 65 * an send - or - recv request. 66 * @param request (IN) the address of an ompi_request. 67 * @return address of the custom vprotocol data associated with the request. 68 */ 69 #define VPROTOCOL_FTREQ(req) ( \ 70 assert((MCA_PML_REQUEST_SEND == \ 71 ((mca_pml_base_request_t *) req)->req_type) || \ 72 (MCA_PML_REQUEST_RECV == \ 73 ((mca_pml_base_request_t *) req)->req_type)), \ 74 ((MCA_PML_REQUEST_SEND == ((mca_pml_base_request_t *) req)->req_type) \ 75 ? VPROTOCOL_SEND_FTREQ(req) \ 76 : VPROTOCOL_RECV_FTREQ(req) \ 77 ) \ 78 ) 79 80 END_C_DECLS 81 82 #endif /* __INCLUDE_VPROTOCOL_REQUEST_H_ */