File: osc_pt2pt_pending_frag.h

package info (click to toggle)
openmpi 4.1.4-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 127,592 kB
  • sloc: ansic: 690,998; makefile: 43,047; f90: 19,220; sh: 7,182; java: 6,360; perl: 3,590; cpp: 2,227; python: 1,350; lex: 989; fortran: 61; tcl: 12
file content (68 lines) | stat: -rw-r--r-- 2,117 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
 * Copyright (c) 2013      Sandia National Laboratories.  All rights reserved.
 * Copyright (c) 2014      Los Alamos National Security, LLC. All rights
 *                         reserved.
 * $COPYRIGHT$
 *
 * Additional copyrights may follow
 *
 * $HEADER$
 *
 * Pending frags are fragments that have been received on the target,
 * but can not yet be processed (because ordering is turned on).
 * Because receive memory descriptors are precious resources, rather
 * than keeping a descriptor until the right sequence number, we
 * instead malloc a buffer (as part of the pending frag) and copy the
 * message.
 */

#ifndef OSC_PT2PT_PENDING_FRAG_H
#define OSC_PT2PT_PENDING_FRAG_H

/** Incoming fragment that has to be queued */
struct ompi_osc_pt2pt_pending_frag_t {
    opal_list_item_t super;

    /* This is a pointer to the top of the fragment (which is always
       the header).  Save as a header to make the casting a bit less
       onerous during sequence number lookups. */
    ompi_osc_pt2pt_frag_header_t *header;
};
typedef struct ompi_osc_pt2pt_pending_frag_t ompi_osc_pt2pt_pending_frag_t;
OBJ_CLASS_DECLARATION(ompi_osc_pt2pt_pending_frag_t);

/*
 * Note: module lock must be held during this operation
 */
static inline ompi_osc_pt2pt_pending_frag_t*
ompi_osc_pt2pt_pending_frag_create(ompi_osc_pt2pt_module_t *module,
                                  void *ptr,
                                  size_t size)
{
    size_t total_size = sizeof(ompi_osc_pt2pt_pending_frag_t) + size;
    ompi_osc_pt2pt_pending_frag_t *ret =
        (ompi_osc_pt2pt_pending_frag_t*) malloc(total_size);
    if (NULL == ret) return NULL;

    OBJ_CONSTRUCT(&ret, ompi_osc_pt2pt_pending_frag_t);
    memcpy(ret->header, ptr, size);

    return ret;
}


/*
 * Note: module lock must be held for this operation
 */
static inline int
ompi_osc_pt2pt_pending_frag_destroy(ompi_osc_pt2pt_module_t *module,
                                   ompi_osc_pt2pt_pending_frag_t* frag)
{
    OBJ_DESTRUCT(&frag);
    free(frag);

    return OMPI_SUCCESS;
}

#endif