1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ 2 /* 3 * Copyright (c) 2014 Mellanox Technologies, Inc. 4 * All rights reserved. 5 * $COPYRIGHT$ 6 * 7 * Additional copyrights may follow 8 * 9 * $HEADER$ 10 * 11 */ 12 13 #if !defined(MCA_OOB_UD_SEND_H) 14 #define MCA_OOB_UD_SEND_H 15 16 #include "oob_ud_component.h" 17 18 #define min(a,b) ((a) < (b) ? (a) : (b)) 19 20 #define MCA_OOB_UD_IOV_SIZE(msg, size) \ 21 do { \ 22 if (msg->iov != NULL) { \ 23 int i; \ 24 for (i = 0, (size) = 0 ; i < (msg->count) ; ++i) { \ 25 (size) += (msg->iov)[i].iov_len; \ 26 } \ 27 } else { \ 28 (size) = msg->buffer->bytes_used; \ 29 } \ 30 } while (0); 31 32 /* State machine for processing message */ 33 typedef struct { 34 opal_object_t super; 35 opal_event_t ev; 36 orte_rml_send_t *msg; 37 } mca_oob_ud_msg_op_t; 38 OBJ_CLASS_DECLARATION(mca_oob_ud_msg_op_t); 39 40 #define ORTE_ACTIVATE_UD_POST_SEND(ms, cbfunc) \ 41 do { \ 42 mca_oob_ud_msg_op_t *mop; \ 43 opal_output_verbose(5, orte_oob_base_framework.framework_output,\ 44 "%s:[%s:%d] post send to %s", \ 45 ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), \ 46 __FILE__, __LINE__, \ 47 ORTE_NAME_PRINT(&((ms)->dst))); \ 48 mop = OBJ_NEW(mca_oob_ud_msg_op_t); \ 49 mop->msg = (ms); \ 50 opal_event_set(mca_oob_ud_module.ev_base, &mop->ev, -1, \ 51 OPAL_EV_WRITE, (cbfunc), mop); \ 52 opal_event_set_priority(&mop->ev, ORTE_MSG_PRI); \ 53 opal_event_active(&mop->ev, OPAL_EV_WRITE, 1); \ 54 } while(0); 55 #endif 56