Motr  M0
In-Memory Messaging and Bulk Transfer Emulation Transport
Collaboration diagram for In-Memory Messaging and Bulk Transfer Emulation Transport:

Data Structures

struct  m0_net_bulk_mem_work_item
 
struct  m0_net_bulk_mem_buffer_pvt
 
struct  m0_net_bulk_mem_tm_pvt
 
struct  m0_net_bulk_mem_end_point
 
struct  m0_net_bulk_mem_ops
 
struct  m0_net_bulk_mem_domain_pvt
 
struct  mem_desc
 

Typedefs

typedef void(* m0_net_bulk_mem_work_fn_t) (struct m0_net_transfer_mc *tm, struct m0_net_bulk_mem_work_item *wi)
 

Enumerations

enum  m0_net_bulk_mem_work_opcode {
  M0_NET_XOP_STATE_CHANGE =0, M0_NET_XOP_CANCEL_CB, M0_NET_XOP_MSG_RECV_CB, M0_NET_XOP_MSG_SEND,
  M0_NET_XOP_PASSIVE_BULK_CB, M0_NET_XOP_ACTIVE_BULK, M0_NET_XOP_ERROR_CB, M0_NET_XOP_NR
}
 
enum  m0_net_bulk_mem_tm_state {
  M0_NET_XTM_UNDEFINED = M0_NET_TM_UNDEFINED, M0_NET_XTM_INITIALIZED = M0_NET_TM_INITIALIZED, M0_NET_XTM_STARTING = M0_NET_TM_STARTING, M0_NET_XTM_STARTED = M0_NET_TM_STARTED,
  M0_NET_XTM_STOPPING = M0_NET_TM_STOPPING, M0_NET_XTM_STOPPED = M0_NET_TM_STOPPED, M0_NET_XTM_FAILED = M0_NET_TM_FAILED
}
 
enum  { M0_NET_BULK_MEM_MAX_SEGMENT_SIZE = (1 << 18), M0_NET_BULK_MEM_MAX_BUFFER_SEGMENTS = 16, M0_NET_BULK_MEM_MAX_BUFFER_SIZE = (1 << 22) }
 
enum  { MEM_XO_TIMEOUT_SECS = 20 }
 
enum  { M0_NET_BULK_MEM_XEP_ADDR_LEN = 36 }
 

Functions

static struct m0_net_bulk_mem_buffer_pvtmem_buffer_to_pvt (const struct m0_net_buffer *nb)
 
static struct m0_net_bulk_mem_tm_pvtmem_tm_to_pvt (const struct m0_net_transfer_mc *tm)
 
static struct m0_net_bulk_mem_end_pointmem_ep_to_pvt (const struct m0_net_end_point *ep)
 
static struct m0_net_bulk_mem_domain_pvtmem_dom_to_pvt (const struct m0_net_domain *dom)
 
static struct m0_net_buffermem_wi_to_buffer (struct m0_net_bulk_mem_work_item *wi)
 
static struct m0_net_bulk_mem_work_itemmem_buffer_to_wi (struct m0_net_buffer *buf)
 
static in_addr_t mem_ep_addr (struct m0_net_end_point *ep)
 
static in_port_t mem_ep_port (struct m0_net_end_point *ep)
 
static uint32_t mem_ep_sid (struct m0_net_end_point *ep)
 
static bool mem_sa_eq (const struct sockaddr_in *sa1, const struct sockaddr_in *sa2)
 
M0_INTERNAL int m0_mem_xprt_init (void)
 
M0_INTERNAL void m0_mem_xprt_fini (void)
 
static void mem_wf_passive_bulk_cb (struct m0_net_transfer_mc *tm, struct m0_net_bulk_mem_work_item *wi)
 
static void mem_wf_active_bulk (struct m0_net_transfer_mc *tm, struct m0_net_bulk_mem_work_item *wi)
 
static void mem_xo_end_point_release (struct m0_ref *ref)
 
static void mem_ep_printable (struct m0_net_bulk_mem_end_point *mep, const struct sockaddr_in *sa, uint32_t id)
 
static struct m0_net_bulk_mem_end_pointmem_ep_alloc (void)
 
static void mem_ep_free (struct m0_net_bulk_mem_end_point *mep)
 
static void mem_ep_get (struct m0_net_end_point *ep)
 
static int mem_ep_create (struct m0_net_end_point **epp, struct m0_net_transfer_mc *tm, const struct sockaddr_in *sa, uint32_t id)
 
static bool mem_ep_equals_addr (const struct m0_net_end_point *ep, const struct sockaddr_in *sa)
 
static bool mem_eps_are_equal (const struct m0_net_end_point *ep1, const struct m0_net_end_point *ep2)
 
static int mem_desc_create (struct m0_net_buf_desc *desc, struct m0_net_transfer_mc *tm, enum m0_net_queue_type qt, m0_bcount_t buflen, int64_t buf_id)
 
static int mem_desc_decode (struct m0_net_buf_desc *desc, struct mem_desc **p_md)
 
static bool mem_desc_equal (struct m0_net_buf_desc *d1, struct m0_net_buf_desc *d2)
 
static void mem_wf_msg_recv_cb (struct m0_net_transfer_mc *tm, struct m0_net_bulk_mem_work_item *wi)
 
static int mem_find_remote_tm (struct m0_net_transfer_mc *tm, struct m0_net_end_point *match_ep, struct m0_net_transfer_mc **p_dest_tm, struct m0_net_end_point **p_dest_ep)
 
static void mem_wf_msg_send (struct m0_net_transfer_mc *tm, struct m0_net_bulk_mem_work_item *wi)
 
static bool mem_dom_invariant (const struct m0_net_domain *dom)
 
static bool mem_ep_invariant (const struct m0_net_end_point *ep)
 
static bool mem_buffer_invariant (const struct m0_net_buffer *nb)
 
static bool mem_tm_invariant (const struct m0_net_transfer_mc *tm)
 
static m0_bcount_t mem_buffer_length (const struct m0_net_buffer *nb)
 
static bool mem_buffer_in_bounds (const struct m0_net_buffer *nb)
 
static int mem_copy_buffer (struct m0_net_buffer *dest_nb, struct m0_net_buffer *src_nb, m0_bcount_t num_bytes)
 
static void mem_wi_add (struct m0_net_bulk_mem_work_item *wi, struct m0_net_bulk_mem_tm_pvt *tp)
 
static void mem_post_error (struct m0_net_transfer_mc *tm, int status)
 
static void mem_wi_post_buffer_event (struct m0_net_bulk_mem_work_item *wi)
 
static int mem_bmo_ep_create (struct m0_net_end_point **epp, struct m0_net_transfer_mc *tm, const struct sockaddr_in *sa, uint32_t id)
 
static bool mem_bmo_buffer_in_bounds (const struct m0_net_buffer *nb)
 
static int mem_bmo_desc_create (struct m0_net_buf_desc *desc, struct m0_net_transfer_mc *tm, enum m0_net_queue_type qt, m0_bcount_t buflen, int64_t buf_id)
 
static void mem_wf_state_change (struct m0_net_transfer_mc *tm, struct m0_net_bulk_mem_work_item *wi)
 
static void mem_wf_cancel_cb (struct m0_net_transfer_mc *tm, struct m0_net_bulk_mem_work_item *wi)
 
static void mem_wf_error_cb (struct m0_net_transfer_mc *tm, struct m0_net_bulk_mem_work_item *wi)
 
static void mem_post_error (struct m0_net_transfer_mc *tm, int32_t status)
 
static void mem_xo_tm_worker (struct m0_net_transfer_mc *tm)
 
static int mem_xo_dom_init (const struct m0_net_xprt *xprt, struct m0_net_domain *dom)
 
static void mem_xo_dom_fini (struct m0_net_domain *dom)
 
static m0_bcount_t mem_xo_get_max_buffer_size (const struct m0_net_domain *dom)
 
static m0_bcount_t mem_xo_get_max_buffer_segment_size (const struct m0_net_domain *dom)
 
static int32_t mem_xo_get_max_buffer_segments (const struct m0_net_domain *dom)
 
static int mem_xo_end_point_create (struct m0_net_end_point **epp, struct m0_net_transfer_mc *tm, const char *addr)
 
static int mem_xo_buf_register (struct m0_net_buffer *nb)
 
static void mem_xo_buf_deregister (struct m0_net_buffer *nb)
 
static int mem_xo_buf_add (struct m0_net_buffer *nb)
 
static void mem_xo_buf_del (struct m0_net_buffer *nb)
 
static int mem_xo_tm_init (struct m0_net_transfer_mc *tm)
 
static void mem_xo_tm_fini (struct m0_net_transfer_mc *tm)
 
M0_INTERNAL void m0_net_bulk_mem_tm_set_num_threads (struct m0_net_transfer_mc *tm, size_t num)
 
M0_INTERNAL size_t m0_net_bulk_mem_tm_get_num_threads (const struct m0_net_transfer_mc *tm)
 
static int mem_xo_tm_start (struct m0_net_transfer_mc *tm, const char *addr)
 
static int mem_xo_tm_stop (struct m0_net_transfer_mc *tm, bool cancel)
 
static m0_bcount_t mem_xo_get_max_buffer_desc_size (const struct m0_net_domain *dom)
 

Variables

static struct m0_list mem_domains
 
static const struct m0_net_bulk_mem_ops mem_xprt_methods
 
static const struct m0_net_xprt_ops mem_xo_xprt_ops
 
const struct m0_net_xprt m0_net_bulk_mem_xprt
 
const struct m0_net_xprt m0_net_bulk_mem_xprt
 

Detailed Description

This module provides a network transport with messaging and bulk data transfer across domains within a single process.

An end point address is a string with two tuples separated by a colon (:). The first tuple is the dotted decimal representation of an IPv4 address, and the second is an IP port number.

When used as a base for a derived transport, a third tuple representing an unsigned 32 bit service identifier is supported in the address.

This transport can be used directly for testing purposes. It permits the creation of multiple domains, each with multiple transfer machines, and provides support for message passing and bulk data transfer between transfer machines of different domains. Data is copied between buffers.

It uses a pool of background threads per transfer machine to provide the required threading semantics of the messaging API and the illusion of independent domains.

It can also serve as a "base" module for derived transports that wish to reuse the threading and buffer management support of this module. Derivation is done as follows:

See LNet Transport for an example of a derived transport.

Typedef Documentation

◆ m0_net_bulk_mem_work_fn_t

typedef void(* m0_net_bulk_mem_work_fn_t) (struct m0_net_transfer_mc *tm, struct m0_net_bulk_mem_work_item *wi)

Work functions are invoked from worker threads. There is one work function per work item opcode. Each function has a signature described by this typedef.

Definition at line 272 of file mem_xprt.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
M0_NET_BULK_MEM_MAX_SEGMENT_SIZE 
M0_NET_BULK_MEM_MAX_BUFFER_SEGMENTS 
M0_NET_BULK_MEM_MAX_BUFFER_SIZE 

Max buffer size = max_seg_nr x max_seg_size

Definition at line 38 of file mem_xprt_pvt.h.

◆ anonymous enum

anonymous enum
Enumerator
MEM_XO_TIMEOUT_SECS 

Maximum time for condition to wait, avoids hung thread warning in kernel while TM is idle.

Definition at line 165 of file mem_xprt_tm.c.

◆ anonymous enum

anonymous enum
Enumerator
M0_NET_BULK_MEM_XEP_ADDR_LEN 

Max addr length, 3-tuple

Definition at line 46 of file bulk_mem.h.

◆ m0_net_bulk_mem_tm_state

The internal state of transfer machine in this transport is described by this enumeration.

Note these are similar to but not the same as the external state of the transfer machine - the external state changes only through the state change callback.

Enumerator
M0_NET_XTM_UNDEFINED 
M0_NET_XTM_INITIALIZED 
M0_NET_XTM_STARTING 
M0_NET_XTM_STARTED 
M0_NET_XTM_STOPPING 
M0_NET_XTM_STOPPED 
M0_NET_XTM_FAILED 

Definition at line 139 of file mem_xprt.h.

◆ m0_net_bulk_mem_work_opcode

The worker threads associated with a transfer machine perform units of work described by the opcodes in this enumeration.

Enumerator
M0_NET_XOP_STATE_CHANGE 

Perform a transfer machine state change operation

M0_NET_XOP_CANCEL_CB 

Perform a buffer operation cancellation callback

M0_NET_XOP_MSG_RECV_CB 

perform a message received callback

M0_NET_XOP_MSG_SEND 

perform a message send operation and callback

M0_NET_XOP_PASSIVE_BULK_CB 

perform a passive bulk buffer completion callback

M0_NET_XOP_ACTIVE_BULK 

perform an active bulk buffer transfer operation and callback

M0_NET_XOP_ERROR_CB 

Perform an error callback

M0_NET_XOP_NR 

Definition at line 112 of file mem_xprt.h.

Function Documentation

◆ m0_mem_xprt_fini()

M0_INTERNAL void m0_mem_xprt_fini ( void  )

Transport finalization subroutine called from m0_fini().

Definition at line 59 of file mem_xprt_xo.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_mem_xprt_init()

M0_INTERNAL int m0_mem_xprt_init ( void  )

Transport initialization subroutine called from m0_init().

Definition at line 47 of file mem_xprt_xo.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_net_bulk_mem_tm_get_num_threads()

M0_INTERNAL size_t m0_net_bulk_mem_tm_get_num_threads ( const struct m0_net_transfer_mc tm)

Return the number of threads used by a bulk in-memory transfer machine.

Parameters
tmPointer to the transfer machine.
Return values
Number-of-threads

Definition at line 606 of file mem_xprt_xo.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_net_bulk_mem_tm_set_num_threads()

M0_INTERNAL void m0_net_bulk_mem_tm_set_num_threads ( struct m0_net_transfer_mc tm,
size_t  num 
)

Set the number of worker threads used by a bulk in-memory transfer machine. This can be changed before the the transfer machine has started.

Parameters
tmPointer to the transfer machine.
numNumber of threads.
Precondition
tm->ntm_state == M0_NET_TM_INITIALZIED

Definition at line 594 of file mem_xprt_xo.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mem_bmo_buffer_in_bounds()

static bool mem_bmo_buffer_in_bounds ( const struct m0_net_buffer nb)
inlinestatic

Function to indirectly invoke the mem_buffer_in_bounds subroutine via the domain function pointer, to support derived transports.

See also
mem_buffer_in_bounds()

Definition at line 110 of file mem_xprt_pvt.h.

Here is the caller graph for this function:

◆ mem_bmo_desc_create()

static int mem_bmo_desc_create ( struct m0_net_buf_desc desc,
struct m0_net_transfer_mc tm,
enum m0_net_queue_type  qt,
m0_bcount_t  buflen,
int64_t  buf_id 
)
static

Function to indirectly invoke the mem_desc_create subroutine via the domain function pointer, to support derived transports.

See also
mem_desc_create()

Definition at line 121 of file mem_xprt_pvt.h.

Here is the caller graph for this function:

◆ mem_bmo_ep_create()

static int mem_bmo_ep_create ( struct m0_net_end_point **  epp,
struct m0_net_transfer_mc tm,
const struct sockaddr_in *  sa,
uint32_t  id 
)
inlinestatic

Function to indirectly invoke the mem_ep_create subroutine via the domain function pointer, to support derived transports.

See also
mem_ep_create()

Definition at line 96 of file mem_xprt_pvt.h.

Here is the caller graph for this function:

◆ mem_buffer_in_bounds()

static bool mem_buffer_in_bounds ( const struct m0_net_buffer nb)
static

◆ mem_buffer_invariant()

static bool mem_buffer_invariant ( const struct m0_net_buffer nb)
static
Here is the caller graph for this function:

◆ mem_buffer_length()

static m0_bcount_t mem_buffer_length ( const struct m0_net_buffer nb)
static
Here is the caller graph for this function:

◆ mem_buffer_to_pvt()

static struct m0_net_bulk_mem_buffer_pvt* mem_buffer_to_pvt ( const struct m0_net_buffer nb)
inlinestatic

Recover the buffer private pointer from the buffer pointer.

Definition at line 202 of file mem_xprt.h.

Here is the caller graph for this function:

◆ mem_buffer_to_wi()

static struct m0_net_bulk_mem_work_item* mem_buffer_to_wi ( struct m0_net_buffer buf)
inlinestatic

Function to obtain the work item from a m0_net_buffer pointer.

Parameters
bufferPointer
Return values
WorkItemPointerin buffer private data

Definition at line 399 of file mem_xprt.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mem_copy_buffer()

static int mem_copy_buffer ( struct m0_net_buffer dest_nb,
struct m0_net_buffer src_nb,
m0_bcount_t  num_bytes 
)
static
Here is the caller graph for this function:

◆ mem_desc_create()

static int mem_desc_create ( struct m0_net_buf_desc desc,
struct m0_net_transfer_mc tm,
enum m0_net_queue_type  qt,
m0_bcount_t  buflen,
int64_t  buf_id 
)
static

Create a network buffer descriptor from an in-memory end point.

The descriptor used by the in-memory transport is not encoded as it is never accessed out of the process.

Parameters
epRemote end point allowed active access
tmTransfer machine holding the passive buffer
qtThe queue type
buflenThe amount data to transfer.
buf_idThe buffer identifier.
descReturns the descriptor

Definition at line 205 of file mem_xprt_ep.c.

Here is the call graph for this function:

◆ mem_desc_decode()

static int mem_desc_decode ( struct m0_net_buf_desc desc,
struct mem_desc **  p_md 
)
static

Decodes a network buffer descriptor.

Parameters
descNetwork buffer descriptor pointer.
mdReturns the descriptor contents. The pointer does not allocate memory but instead points to within the network buffer descriptor, so don't free it.
Return values
0On success
-EINVALInvalid transfer descriptor

Definition at line 242 of file mem_xprt_ep.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mem_desc_equal()

static bool mem_desc_equal ( struct m0_net_buf_desc d1,
struct m0_net_buf_desc d2 
)
static

Compares if two descriptors are equal.

Definition at line 255 of file mem_xprt_ep.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mem_dom_invariant()

static bool mem_dom_invariant ( const struct m0_net_domain dom)
static

◆ mem_dom_to_pvt()

static struct m0_net_bulk_mem_domain_pvt* mem_dom_to_pvt ( const struct m0_net_domain dom)
inlinestatic

Recover the domain private from a pointer to the domain.

Definition at line 375 of file mem_xprt.h.

Here is the caller graph for this function:

◆ mem_ep_addr()

static in_addr_t mem_ep_addr ( struct m0_net_end_point ep)
inlinestatic

Function to return the IP address of the end point.

Parameters
epEnd point pointer
Return values
addressIn network byte order.

Definition at line 410 of file mem_xprt.h.

◆ mem_ep_alloc()

static struct m0_net_bulk_mem_end_point* mem_ep_alloc ( void  )
static

Allocate memory for a transport end point.

Definition at line 86 of file mem_xprt_ep.c.

◆ mem_ep_create()

static int mem_ep_create ( struct m0_net_end_point **  epp,
struct m0_net_transfer_mc tm,
const struct sockaddr_in *  sa,
uint32_t  id 
)
static

Internal implementation of mem_xo_end_point_create().

Definition at line 109 of file mem_xprt_ep.c.

Here is the call graph for this function:

◆ mem_ep_equals_addr()

static bool mem_ep_equals_addr ( const struct m0_net_end_point ep,
const struct sockaddr_in *  sa 
)
static

Compare an end point with a sockaddr_in for equality. The id field is not considered.

Parameters
epEnd point
sasockaddr_in pointer
trueMatch
falseDo not match

Definition at line 161 of file mem_xprt_ep.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mem_ep_free()

static void mem_ep_free ( struct m0_net_bulk_mem_end_point mep)
static

Free memory for a transport end point.

Definition at line 96 of file mem_xprt_ep.c.

Here is the call graph for this function:

◆ mem_ep_get()

static void mem_ep_get ( struct m0_net_end_point ep)
static

Definition at line 101 of file mem_xprt_ep.c.

Here is the call graph for this function:

◆ mem_ep_invariant()

static bool mem_ep_invariant ( const struct m0_net_end_point ep)
static
Here is the caller graph for this function:

◆ mem_ep_port()

static in_port_t mem_ep_port ( struct m0_net_end_point ep)
inlinestatic

Function to return the port number of the end point.

Parameters
epEnd point pointer
Return values
portIn network byte order.

Definition at line 422 of file mem_xprt.h.

◆ mem_ep_printable()

static void mem_ep_printable ( struct m0_net_bulk_mem_end_point mep,
const struct sockaddr_in *  sa,
uint32_t  id 
)
static

create the printable representation

Definition at line 56 of file mem_xprt_ep.c.

Here is the caller graph for this function:

◆ mem_ep_sid()

static uint32_t mem_ep_sid ( struct m0_net_end_point ep)
inlinestatic

Function to return the service id of the end point.

Parameters
epEnd point pointer
Return values
serviceid in network byte order

Definition at line 434 of file mem_xprt.h.

◆ mem_ep_to_pvt()

static struct m0_net_bulk_mem_end_point* mem_ep_to_pvt ( const struct m0_net_end_point ep)
inlinestatic

Recover the end point private from a pointer to the end point.

Definition at line 262 of file mem_xprt.h.

Here is the caller graph for this function:

◆ mem_eps_are_equal()

static bool mem_eps_are_equal ( const struct m0_net_end_point ep1,
const struct m0_net_end_point ep2 
)
static

Compare two end points for equality. Only the addresses are matched.

Parameters
ep1First end point
ep2Second end point
trueMatch
falseDo not match

Definition at line 179 of file mem_xprt_ep.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mem_find_remote_tm()

static int mem_find_remote_tm ( struct m0_net_transfer_mc tm,
struct m0_net_end_point match_ep,
struct m0_net_transfer_mc **  p_dest_tm,
struct m0_net_end_point **  p_dest_ep 
)
static

Find a remote TM for a msg send or active buffer operation.

The m0_net_mutex will be obtained to traverse the list of domains. Each domain lock will be held to traverse the transfer machines in the domain. Once the correct transfer machine is found, its lock is obtained and the other locks released.

Parameters
tmLocal TM
match_epEnd point of remote TM
p_dest_tmReturns remote TM pointer, with TM mutex held.
p_dest_epReturns end point in remote TM's domain, with local TM's address. Optional - only msg send requires this. The option exists because the end point object has to be created while holding the remote DOM's mutex.
Return values
0On success
-errnoOn error

Definition at line 67 of file mem_xprt_msg.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mem_post_error() [1/2]

static void mem_post_error ( struct m0_net_transfer_mc tm,
int  status 
)
static
Here is the caller graph for this function:

◆ mem_post_error() [2/2]

static void mem_post_error ( struct m0_net_transfer_mc tm,
int32_t  status 
)
static

Support subroutine to send an error event.

Parameters
tmThe transfer machine.
statusThe error code.
Precondition
m0_mutex_is_locked(&tm->ntm_mutex)

Definition at line 151 of file mem_xprt_tm.c.

Here is the call graph for this function:

◆ mem_sa_eq()

static bool mem_sa_eq ( const struct sockaddr_in *  sa1,
const struct sockaddr_in *  sa2 
)
inlinestatic

Function to compare two struct sockaddr_in structures.

Parameters
sa1Pointer to first structure.
sa2Pointer to second structure.

Definition at line 446 of file mem_xprt.h.

Here is the caller graph for this function:

◆ mem_tm_invariant()

static bool mem_tm_invariant ( const struct m0_net_transfer_mc tm)
static
Here is the caller graph for this function:

◆ mem_tm_to_pvt()

static struct m0_net_bulk_mem_tm_pvt* mem_tm_to_pvt ( const struct m0_net_transfer_mc tm)
inlinestatic

Recover the TM private pointer from a pointer to the TM.

Definition at line 231 of file mem_xprt.h.

Here is the caller graph for this function:

◆ mem_wf_active_bulk()

static void mem_wf_active_bulk ( struct m0_net_transfer_mc tm,
struct m0_net_bulk_mem_work_item wi 
)
static

Perform a bulk data transfer, and invoke the completion callback on the active buffer.

Parameters
tmThe active TM
wiThe work item.

Definition at line 56 of file mem_xprt_bulk.c.

Here is the call graph for this function:

◆ mem_wf_cancel_cb()

static void mem_wf_cancel_cb ( struct m0_net_transfer_mc tm,
struct m0_net_bulk_mem_work_item wi 
)
static

Deliver a callback during operation cancel.

Definition at line 107 of file mem_xprt_tm.c.

Here is the call graph for this function:

◆ mem_wf_error_cb()

static void mem_wf_error_cb ( struct m0_net_transfer_mc tm,
struct m0_net_bulk_mem_work_item wi 
)
static

Work function for the M0_NET_XOP_ERROR_CB work item.

Parameters
tmThe corresponding transfer machine (unlocked).
wiThe work item. This will be freed.

Definition at line 129 of file mem_xprt_tm.c.

Here is the call graph for this function:

◆ mem_wf_msg_recv_cb()

static void mem_wf_msg_recv_cb ( struct m0_net_transfer_mc tm,
struct m0_net_bulk_mem_work_item wi 
)
static

Definition at line 30 of file mem_xprt_msg.c.

Here is the call graph for this function:

◆ mem_wf_msg_send()

static void mem_wf_msg_send ( struct m0_net_transfer_mc tm,
struct m0_net_bulk_mem_work_item wi 
)
static

This item involves copying the buffer to the appropriate receive buffer (if available) of the target transfer machine in the destination domain, adding a M0_NET_XOP_MSG_RECV_CB item on that queue, and then invoking the completion callback on the send buffer. An end point object describing the sender's address will be referenced from the receiving buffer.

If a suitable transfer machine is not found then the message send fails.

Definition at line 166 of file mem_xprt_msg.c.

Here is the call graph for this function:

◆ mem_wf_passive_bulk_cb()

static void mem_wf_passive_bulk_cb ( struct m0_net_transfer_mc tm,
struct m0_net_bulk_mem_work_item wi 
)
static

Invoke the completion callback on a passive bulk transfer buffer.

Definition at line 33 of file mem_xprt_bulk.c.

Here is the call graph for this function:

◆ mem_wf_state_change()

static void mem_wf_state_change ( struct m0_net_transfer_mc tm,
struct m0_net_bulk_mem_work_item wi 
)
static

Work function for the M0_NET_XOP_STATE_CHANGE work item.

Parameters
tmthe corresponding transfer machine
withe work item, this will be freed

Definition at line 35 of file mem_xprt_tm.c.

Here is the call graph for this function:

◆ mem_wi_add()

static void mem_wi_add ( struct m0_net_bulk_mem_work_item wi,
struct m0_net_bulk_mem_tm_pvt tp 
)
static
Here is the caller graph for this function:

◆ mem_wi_post_buffer_event()

static void mem_wi_post_buffer_event ( struct m0_net_bulk_mem_work_item wi)
static
Here is the caller graph for this function:

◆ mem_wi_to_buffer()

static struct m0_net_buffer* mem_wi_to_buffer ( struct m0_net_bulk_mem_work_item wi)
inlinestatic

Function obtain the m0_net_buffer pointer from its related work item.

Parameters
wiWork item pointer in embedded buffer private data
Return values
bufferPointer

Definition at line 386 of file mem_xprt.h.

Here is the caller graph for this function:

◆ mem_xo_buf_add()

static int mem_xo_buf_add ( struct m0_net_buffer nb)
static

This routine initiates processing of the buffer operation.

Definition at line 401 of file mem_xprt_xo.c.

Here is the call graph for this function:

◆ mem_xo_buf_del()

static void mem_xo_buf_del ( struct m0_net_buffer nb)
static

Cancel ongoing buffer operations. May also be invoked to time out a pending buffer operation by first setting the M0_NET_BUF_TIMED_OUT flag.

Parameters
nbBuffer pointer

Definition at line 470 of file mem_xprt_xo.c.

Here is the call graph for this function:

◆ mem_xo_buf_deregister()

static void mem_xo_buf_deregister ( struct m0_net_buffer nb)
static

This routine releases references from the private data associated with the buffer, and frees the private data if the transport was used directly. Derived transports should free the private data upon return from this subroutine.

Definition at line 382 of file mem_xprt_xo.c.

Here is the call graph for this function:

◆ mem_xo_buf_register()

static int mem_xo_buf_register ( struct m0_net_buffer nb)
static

This routine initializes the private data associated with the buffer.

The private data is allocated here when the transport is used directly. Derived transports should allocate the buffer private data before invoking this method. The nb_xprt_private field should be set to point to this transports private data.

Definition at line 346 of file mem_xprt_xo.c.

Here is the call graph for this function:

◆ mem_xo_dom_fini()

static void mem_xo_dom_fini ( struct m0_net_domain dom)
static

This subroutine releases references from the private data. If not derived, it will unlink the domain and free the private data. Derived transports should free the private data upon return from this subroutine.

Definition at line 245 of file mem_xprt_xo.c.

Here is the call graph for this function:

◆ mem_xo_dom_init()

static int mem_xo_dom_init ( const struct m0_net_xprt xprt,
struct m0_net_domain dom 
)
static

This routine will allocate and initialize the private domain data and attach it to the domain. It will assume that the domains private pointer is allocated if not NULL. This allows for a derived transport to pre-allocate this structure before invoking the base method. The method will initialize the size and count fields as per the requirements of the in-memory module. If the private domain pointer was not allocated, the routine will assume that the domain is not derived, and will then link the domain in a private list to facilitate in-memory data transfers between transfer machines.

Definition at line 200 of file mem_xprt_xo.c.

Here is the call graph for this function:

◆ mem_xo_end_point_create()

static int mem_xo_end_point_create ( struct m0_net_end_point **  epp,
struct m0_net_transfer_mc tm,
const char *  addr 
)
static

This routine will search for an existing end point in the domain, and if not found, will allocate and zero out space for a new end point using the xd_sizeof_ep field to determine the size. It will fill in the xep_address field with the IP and port number, and will link the end point to the domain link list.

Dynamic address assignment is not supported.

Parameters
eppReturns the pointer to the end point.
domDomain pointer.
addrAddress string in one of the following two formats:
  • "dottedIP:portNumber" if 2-tuple addressing used.
  • "dottedIP:portNumber:serviceId" if 3-tuple addressing used.

Definition at line 290 of file mem_xprt_xo.c.

Here is the call graph for this function:

◆ mem_xo_end_point_release()

static void mem_xo_end_point_release ( struct m0_ref ref)
static

End point release subroutine invoked when the reference count goes to 0. Unlinks the end point from the domain, and releases the memory. Must be called holding the domain mutex.

Definition at line 40 of file mem_xprt_ep.c.

Here is the call graph for this function:

◆ mem_xo_get_max_buffer_desc_size()

static m0_bcount_t mem_xo_get_max_buffer_desc_size ( const struct m0_net_domain dom)
static

Definition at line 707 of file mem_xprt_xo.c.

Here is the call graph for this function:

◆ mem_xo_get_max_buffer_segment_size()

static m0_bcount_t mem_xo_get_max_buffer_segment_size ( const struct m0_net_domain dom)
static

Definition at line 263 of file mem_xprt_xo.c.

Here is the call graph for this function:

◆ mem_xo_get_max_buffer_segments()

static int32_t mem_xo_get_max_buffer_segments ( const struct m0_net_domain dom)
static

Definition at line 270 of file mem_xprt_xo.c.

Here is the call graph for this function:

◆ mem_xo_get_max_buffer_size()

static m0_bcount_t mem_xo_get_max_buffer_size ( const struct m0_net_domain dom)
static

Definition at line 257 of file mem_xprt_xo.c.

Here is the call graph for this function:

◆ mem_xo_tm_fini()

static void mem_xo_tm_fini ( struct m0_net_transfer_mc tm)
static

Finalize a transfer machine. Derived transports should free the private data upon return from this subroutine.

Parameters
tmTransfer machine pointer

Definition at line 562 of file mem_xprt_xo.c.

Here is the call graph for this function:

◆ mem_xo_tm_init()

static int mem_xo_tm_init ( struct m0_net_transfer_mc tm)
static

Initialize a transfer machine.

The private data is allocated here if the transport is used directly. Derived transports should allocate their private data prior to calling this subroutine, and set the TM private pointer to point to the embedded private structure of this transport.

Parameters
tmTransfer machine pointer
Return values
0on success
-ENOMEMif memory not available

Definition at line 526 of file mem_xprt_xo.c.

Here is the call graph for this function:

◆ mem_xo_tm_start()

static int mem_xo_tm_start ( struct m0_net_transfer_mc tm,
const char *  addr 
)
static

Definition at line 614 of file mem_xprt_xo.c.

Here is the call graph for this function:

◆ mem_xo_tm_stop()

static int mem_xo_tm_stop ( struct m0_net_transfer_mc tm,
bool  cancel 
)
static

Definition at line 680 of file mem_xprt_xo.c.

Here is the call graph for this function:

◆ mem_xo_tm_worker()

static void mem_xo_tm_worker ( struct m0_net_transfer_mc tm)
static

The entry point of the worker thread started when a transfer machine transitions from STARTING to STARTED. The thread runs its main loop until it the transfer machine state changes to X2_NET_XTM_STOPPED, at which time the function returns, causing the thread to exit.

Parameters
tmTransfer machine pointer

Definition at line 180 of file mem_xprt_tm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ m0_net_bulk_mem_xprt [1/2]

const struct m0_net_xprt m0_net_bulk_mem_xprt
Initial value:
= {
.nx_name = "bulk-mem",
.nx_ops = &mem_xo_xprt_ops
}
static const struct m0_net_xprt_ops mem_xo_xprt_ops
Definition: mem_xprt_xo.c:738

The bulk in-memory transport pointer to be used in m0_net_domain_init().

Definition at line 761 of file mem_xprt_xo.c.

◆ m0_net_bulk_mem_xprt [2/2]

const struct m0_net_xprt m0_net_bulk_mem_xprt

The bulk in-memory transport pointer to be used in m0_net_domain_init().

Definition at line 761 of file mem_xprt_xo.c.

◆ mem_domains

struct m0_list mem_domains
static

List of in-memory network domains. Protected by struct m0_net_mutex.

Definition at line 39 of file mem_xprt_xo.c.

◆ mem_xo_xprt_ops

const struct m0_net_xprt_ops mem_xo_xprt_ops
static
Initial value:
= {
.xo_dom_init = mem_xo_dom_init,
.xo_dom_fini = mem_xo_dom_fini,
.xo_get_max_buffer_size = mem_xo_get_max_buffer_size,
.xo_get_max_buffer_segment_size = mem_xo_get_max_buffer_segment_size,
.xo_get_max_buffer_segments = mem_xo_get_max_buffer_segments,
.xo_end_point_create = mem_xo_end_point_create,
.xo_buf_register = mem_xo_buf_register,
.xo_buf_deregister = mem_xo_buf_deregister,
.xo_buf_add = mem_xo_buf_add,
.xo_buf_del = mem_xo_buf_del,
.xo_tm_init = mem_xo_tm_init,
.xo_tm_fini = mem_xo_tm_fini,
.xo_tm_start = mem_xo_tm_start,
.xo_tm_stop = mem_xo_tm_stop,
.xo_get_max_buffer_desc_size = mem_xo_get_max_buffer_desc_size,
.xo_rpc_max_seg_size = default_xo_rpc_max_seg_size,
.xo_rpc_max_segs_nr = default_xo_rpc_max_segs_nr,
.xo_rpc_max_msg_size = default_xo_rpc_max_msg_size,
.xo_rpc_max_recv_msgs = default_xo_rpc_max_recv_msgs,
}
static int mem_xo_tm_start(struct m0_net_transfer_mc *tm, const char *addr)
Definition: mem_xprt_xo.c:614
static m0_bcount_t mem_xo_get_max_buffer_desc_size(const struct m0_net_domain *dom)
Definition: mem_xprt_xo.c:707
static int mem_xo_buf_register(struct m0_net_buffer *nb)
Definition: mem_xprt_xo.c:346
static int mem_xo_end_point_create(struct m0_net_end_point **epp, struct m0_net_transfer_mc *tm, const char *addr)
Definition: mem_xprt_xo.c:290
M0_INTERNAL uint32_t default_xo_rpc_max_segs_nr(struct m0_net_domain *ndom)
Definition: net.c:247
static void mem_xo_buf_del(struct m0_net_buffer *nb)
Definition: mem_xprt_xo.c:470
static void mem_xo_dom_fini(struct m0_net_domain *dom)
Definition: mem_xprt_xo.c:245
static m0_bcount_t mem_xo_get_max_buffer_size(const struct m0_net_domain *dom)
Definition: mem_xprt_xo.c:257
static int mem_xo_buf_add(struct m0_net_buffer *nb)
Definition: mem_xprt_xo.c:401
static void mem_xo_buf_deregister(struct m0_net_buffer *nb)
Definition: mem_xprt_xo.c:382
M0_INTERNAL m0_bcount_t default_xo_rpc_max_seg_size(struct m0_net_domain *ndom)
Definition: net.c:239
static m0_bcount_t mem_xo_get_max_buffer_segment_size(const struct m0_net_domain *dom)
Definition: mem_xprt_xo.c:263
static int mem_xo_tm_init(struct m0_net_transfer_mc *tm)
Definition: mem_xprt_xo.c:526
static void mem_xo_tm_fini(struct m0_net_transfer_mc *tm)
Definition: mem_xprt_xo.c:562
static int mem_xo_dom_init(const struct m0_net_xprt *xprt, struct m0_net_domain *dom)
Definition: mem_xprt_xo.c:200
M0_INTERNAL uint32_t default_xo_rpc_max_recv_msgs(struct m0_net_domain *ndom, m0_bcount_t rpc_size)
Definition: net.c:267
M0_INTERNAL m0_bcount_t default_xo_rpc_max_msg_size(struct m0_net_domain *ndom, m0_bcount_t rpc_size)
Definition: net.c:255
static int32_t mem_xo_get_max_buffer_segments(const struct m0_net_domain *dom)
Definition: mem_xprt_xo.c:270
static int mem_xo_tm_stop(struct m0_net_transfer_mc *tm, bool cancel)
Definition: mem_xprt_xo.c:680

Definition at line 738 of file mem_xprt_xo.c.

◆ mem_xprt_methods

static const struct m0_net_bulk_mem_ops mem_xprt_methods
static
Initial value:
= {
.bmo_work_fn = {
},
.bmo_ep_create = mem_ep_create,
.bmo_ep_alloc = mem_ep_alloc,
.bmo_ep_free = mem_ep_free,
.bmo_ep_release = mem_xo_end_point_release,
.bmo_ep_get = mem_ep_get,
.bmo_wi_add = mem_wi_add,
.bmo_buffer_in_bounds = mem_buffer_in_bounds,
.bmo_desc_create = mem_desc_create,
.bmo_post_error = mem_post_error,
.bmo_wi_post_buffer_event = mem_wi_post_buffer_event,
}
static struct m0_net_bulk_mem_end_point * mem_ep_alloc(void)
Definition: mem_xprt_ep.c:86
static void mem_wf_msg_send(struct m0_net_transfer_mc *tm, struct m0_net_bulk_mem_work_item *wi)
Definition: mem_xprt_msg.c:166
static void mem_wf_msg_recv_cb(struct m0_net_transfer_mc *tm, struct m0_net_bulk_mem_work_item *wi)
Definition: mem_xprt_msg.c:30
static void mem_wi_post_buffer_event(struct m0_net_bulk_mem_work_item *wi)
Definition: mem_xprt_xo.c:147
static void mem_wi_add(struct m0_net_bulk_mem_work_item *wi, struct m0_net_bulk_mem_tm_pvt *tp)
Definition: mem_xprt_xo.c:137
static void mem_wf_cancel_cb(struct m0_net_transfer_mc *tm, struct m0_net_bulk_mem_work_item *wi)
Definition: mem_xprt_tm.c:107
static void mem_wf_state_change(struct m0_net_transfer_mc *tm, struct m0_net_bulk_mem_work_item *wi)
Definition: mem_xprt_tm.c:35
static void mem_post_error(struct m0_net_transfer_mc *tm, int status)
static void mem_xo_end_point_release(struct m0_ref *ref)
Definition: mem_xprt_ep.c:40
static void mem_wf_active_bulk(struct m0_net_transfer_mc *tm, struct m0_net_bulk_mem_work_item *wi)
Definition: mem_xprt_bulk.c:56
static bool mem_buffer_in_bounds(const struct m0_net_buffer *nb)
Definition: mem_xprt_xo.c:85
static void mem_wf_passive_bulk_cb(struct m0_net_transfer_mc *tm, struct m0_net_bulk_mem_work_item *wi)
Definition: mem_xprt_bulk.c:33
static int mem_ep_create(struct m0_net_end_point **epp, struct m0_net_transfer_mc *tm, const struct sockaddr_in *sa, uint32_t id)
Definition: mem_xprt_ep.c:109
static void mem_ep_get(struct m0_net_end_point *ep)
Definition: mem_xprt_ep.c:101
static int mem_desc_create(struct m0_net_buf_desc *desc, struct m0_net_transfer_mc *tm, enum m0_net_queue_type qt, m0_bcount_t buflen, int64_t buf_id)
Definition: mem_xprt_ep.c:205
static void mem_ep_free(struct m0_net_bulk_mem_end_point *mep)
Definition: mem_xprt_ep.c:96
static void mem_wf_error_cb(struct m0_net_transfer_mc *tm, struct m0_net_bulk_mem_work_item *wi)
Definition: mem_xprt_tm.c:129

Definition at line 42 of file mem_xprt_xo.c.