root/opal/mca/btl/usnic/btl_usnic_ack.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. opal_btl_usnic_piggyback_ack

   1 /*
   2  * Copyright (c) 2013-2017 Cisco Systems, Inc.  All rights reserved.
   3  * $COPYRIGHT$
   4  *
   5  * Additional copyrights may follow
   6  *
   7  * $HEADER$
   8  */
   9 
  10 #ifndef BTL_USNIC_ACK_H
  11 #define BTL_USNIC_ACK_H
  12 
  13 #include "opal_config.h"
  14 
  15 #include "opal/class/opal_hotel.h"
  16 
  17 #include "btl_usnic.h"
  18 #include "btl_usnic_frag.h"
  19 #include "btl_usnic_endpoint.h"
  20 #include "btl_usnic_compat.h"
  21 
  22 /* Invoke the descriptor callback for a (non-PUT) send frag, updating
  23  * stats and clearing the _CALLBACK flag in the process. */
  24 #define OPAL_BTL_USNIC_DO_SEND_FRAG_CB(module, send_frag, comment)            \
  25     do {                                                                      \
  26         MSGDEBUG1_OUT("%s:%d: %s SEND callback for module=%p frag=%p\n",      \
  27                       __func__, __LINE__,                                     \
  28                       (comment), (void *)(module), (void *)(send_frag));      \
  29         (send_frag)->sf_base.uf_base.des_cbfunc(                              \
  30             &(module)->super,                                                 \
  31             (send_frag)->sf_endpoint,                                         \
  32             &(send_frag)->sf_base.uf_base,                                    \
  33             OPAL_SUCCESS);                                                    \
  34         frag->sf_base.uf_base.des_flags &= ~MCA_BTL_DES_SEND_ALWAYS_CALLBACK; \
  35         ++((module)->stats.pml_send_callbacks);                               \
  36     } while (0)
  37 
  38 #if BTL_VERSION == 30
  39 /* Invoke the descriptor callback for a send frag that was a PUT,
  40  * updating stats and clearing the _CALLBACK flag in the process. */
  41 #define OPAL_BTL_USNIC_DO_PUT_FRAG_CB(module, send_frag, comment)             \
  42     do {                                                                      \
  43         MSGDEBUG1_OUT("%s:%d: %s PUT callback for module=%p frag=%p\n",       \
  44                       __func__, __LINE__,                                     \
  45                       (comment), (void *)(module), (void *)(send_frag));      \
  46         mca_btl_base_rdma_completion_fn_t func =                        \
  47             (mca_btl_base_rdma_completion_fn_t)                         \
  48             (send_frag)->sf_base.uf_base.des_cbfunc;                    \
  49         func(&(module)->super,                                          \
  50              (send_frag)->sf_endpoint,                                  \
  51              (send_frag)->sf_base.uf_local_seg[0].seg_addr.pval,        \
  52              NULL,                                                      \
  53              (send_frag)->sf_base.uf_base.des_context,                  \
  54              (send_frag)->sf_base.uf_base.des_cbdata,                   \
  55              OPAL_SUCCESS);                                             \
  56         ++((module)->stats.pml_send_callbacks);                         \
  57     } while (0)
  58 #endif
  59 
  60 /*
  61  * Reap an ACK send that is complete
  62  */
  63 void opal_btl_usnic_ack_complete(opal_btl_usnic_module_t *module,
  64                                    opal_btl_usnic_ack_segment_t *ack);
  65 
  66 
  67 /*
  68  * Send an ACK
  69  */
  70 int opal_btl_usnic_ack_send(opal_btl_usnic_module_t *module,
  71                                opal_btl_usnic_endpoint_t *endpoint);
  72 
  73 /*
  74  * Callback for when a send times out without receiving a
  75  * corresponding ACK
  76  */
  77 void opal_btl_usnic_ack_timeout(opal_hotel_t *hotel, int room_num,
  78                                   void *occupant);
  79 
  80 /*
  81  * Handle an incoming ACK
  82  */
  83 void opal_btl_usnic_handle_ack(opal_btl_usnic_endpoint_t *endpoint,
  84                                opal_btl_usnic_seq_t ack_seq);
  85 
  86 static inline void
  87 opal_btl_usnic_piggyback_ack(
  88     opal_btl_usnic_endpoint_t *endpoint,
  89     opal_btl_usnic_send_segment_t *sseg)
  90 {
  91     /* If ACK is needed, piggy-back it here and send it on */
  92     if (endpoint->endpoint_ack_needed) {
  93         opal_btl_usnic_remove_from_endpoints_needing_ack(endpoint);
  94         sseg->ss_base.us_btl_header->ack_seq =
  95             SEQ_DIFF(endpoint->endpoint_next_contig_seq_to_recv, 1);
  96         sseg->ss_base.us_btl_header->ack_present = 1;
  97 #if MSGDEBUG1
  98         opal_output(0, "Piggy-backing ACK for sequence %"UDSEQ"\n",
  99                 sseg->ss_base.us_btl_header->ack_seq);
 100 #endif
 101     } else {
 102         sseg->ss_base.us_btl_header->ack_present = 0;
 103     }
 104 }
 105 
 106 
 107 #endif /* BTL_USNIC_ACK_H */

/* [<][>][^][v][top][bottom][index][help] */