Motr  M0
LNet Transport Core User Space Private Interface
Collaboration diagram for LNet Transport Core User Space Private Interface:

Data Structures

struct  nlx_ucore_domain
 
struct  nlx_ucore_transfer_mc
 
struct  nlx_ucore_buffer
 

Macros

#define NLX_UCORE_BUF_OP(op, loc, ...)
 

Functions

static bool nlx_ucore_domain_invariant (const struct nlx_ucore_domain *ud)
 
static bool nlx_ucore_buffer_invariant (const struct nlx_ucore_buffer *ub)
 
static bool nlx_ucore_tm_invariant (const struct nlx_ucore_transfer_mc *utm)
 
M0_INTERNAL void * nlx_core_mem_alloc (size_t size, unsigned shift)
 
M0_INTERNAL void nlx_core_mem_free (void *data, size_t size, unsigned shift)
 
static int nlx_ucore_ioctl (int fd, unsigned long cmd, void *arg)
 
static int nlx_ucore_nidstrs_get (struct nlx_ucore_domain *ud, char ***nidary)
 
static void nlx_ucore_nidstrs_put (struct nlx_ucore_domain *ud, char ***nidary)
 
M0_INTERNAL int nlx_core_dom_init (struct m0_net_domain *dom, struct nlx_core_domain *cd)
 
M0_INTERNAL void nlx_core_dom_fini (struct nlx_core_domain *cd)
 
M0_INTERNAL m0_bcount_t nlx_core_get_max_buffer_size (struct nlx_core_domain *cd)
 
M0_INTERNAL m0_bcount_t nlx_core_get_max_buffer_segment_size (struct nlx_core_domain *cd)
 
M0_INTERNAL int32_t nlx_core_get_max_buffer_segments (struct nlx_core_domain *cd)
 
M0_INTERNAL int nlx_core_buf_register (struct nlx_core_domain *cd, nlx_core_opaque_ptr_t buffer_id, const struct m0_bufvec *bvec, struct nlx_core_buffer *cb)
 
M0_INTERNAL void nlx_core_buf_deregister (struct nlx_core_domain *cd, struct nlx_core_buffer *cb)
 
M0_INTERNAL int nlx_core_buf_msg_recv (struct nlx_core_domain *cd, struct nlx_core_transfer_mc *ctm, struct nlx_core_buffer *cb)
 
M0_INTERNAL int nlx_core_buf_msg_send (struct nlx_core_domain *cd, struct nlx_core_transfer_mc *ctm, struct nlx_core_buffer *cb)
 
M0_INTERNAL int nlx_core_buf_active_recv (struct nlx_core_domain *cd, struct nlx_core_transfer_mc *ctm, struct nlx_core_buffer *cb)
 
M0_INTERNAL int nlx_core_buf_active_send (struct nlx_core_domain *cd, struct nlx_core_transfer_mc *ctm, struct nlx_core_buffer *cb)
 
M0_INTERNAL int nlx_core_buf_passive_recv (struct nlx_core_domain *cd, struct nlx_core_transfer_mc *ctm, struct nlx_core_buffer *cb)
 
M0_INTERNAL int nlx_core_buf_passive_send (struct nlx_core_domain *cd, struct nlx_core_transfer_mc *ctm, struct nlx_core_buffer *cb)
 
M0_INTERNAL int nlx_core_buf_del (struct nlx_core_domain *cd, struct nlx_core_transfer_mc *ctm, struct nlx_core_buffer *cb)
 
int nlx_core_buf_event_wait (struct nlx_core_domain *cd, struct nlx_core_transfer_mc *ctm, m0_time_t timeout)
 
M0_INTERNAL int nlx_core_nidstr_decode (struct nlx_core_domain *cd, const char *nidstr, uint64_t *nid)
 
M0_INTERNAL int nlx_core_nidstr_encode (struct nlx_core_domain *cd, uint64_t nid, char nidstr[M0_NET_LNET_NIDSTR_SIZE])
 
M0_INTERNAL int nlx_core_nidstrs_get (struct nlx_core_domain *cd, char ***nidary)
 
M0_INTERNAL void nlx_core_nidstrs_put (struct nlx_core_domain *cd, char ***nidary)
 
static void nlx_ucore_tm_stop (struct nlx_core_domain *cd, struct nlx_core_transfer_mc *ctm)
 
M0_INTERNAL int nlx_core_tm_start (struct nlx_core_domain *cd, struct m0_net_transfer_mc *tm, struct nlx_core_transfer_mc *ctm)
 
M0_INTERNAL void nlx_core_tm_stop (struct nlx_core_domain *cd, struct nlx_core_transfer_mc *ctm)
 
M0_INTERNAL int nlx_core_new_blessed_bev (struct nlx_core_domain *cd, struct nlx_core_transfer_mc *ctm, struct nlx_core_buffer_event **bevp)
 
static void nlx_core_fini (void)
 
static int nlx_core_init (void)
 

Variables

static const char * nlx_ucore_dev_name = "/dev/" M0_LNET_DEV
 
static unsigned nlx_ucore_nidstrs_thunk = 128
 

Detailed Description

Macro Definition Documentation

◆ NLX_UCORE_BUF_OP

#define NLX_UCORE_BUF_OP (   op,
  loc,
  ... 
)
Value:
struct nlx_ucore_domain *ud; \
struct nlx_ucore_transfer_mc *utm; \
struct nlx_ucore_buffer *ub; \
int rc = 0; \
M0_PRE(cd != NULL); \
ud = cd->cd_upvt; \
utm = ctm->ctm_upvt; \
M0_PRE(nlx_ucore_tm_invariant(utm)); \
ub = cb->cb_upvt; \
\
__VA_ARGS__; \
\
dbqp.dbq_ktm = ctm->ctm_kpvt; \
dbqp.dbq_kb = cb->cb_kpvt; \
rc = nlx_ucore_ioctl(ud->ud_fd, op, &dbqp)
#define M0_PRE(cond)
#define NULL
Definition: misc.h:38
static bool nlx_core_buffer_invariant(const struct nlx_core_buffer *lcb)
Definition: lnet_core.c:149
static bool nlx_ucore_domain_invariant(const struct nlx_ucore_domain *ud)
Definition: ulnet_core.c:507
op
Definition: libdemo.c:64
static bool nlx_ucore_buffer_invariant(const struct nlx_ucore_buffer *ub)
Definition: ulnet_core.c:519
static int nlx_ucore_ioctl(int fd, unsigned long cmd, void *arg)
Definition: ulnet_core.c:548
static bool nlx_core_tm_invariant(const struct nlx_core_transfer_mc *lctm)
Definition: lnet_core.c:120
static bool nlx_ucore_tm_invariant(const struct nlx_ucore_transfer_mc *utm)
Definition: ulnet_core.c:527
int32_t rc
Definition: trigger_fop.h:47

Definition at line 820 of file ulnet_core.c.

Function Documentation

◆ nlx_core_buf_active_recv()

M0_INTERNAL int nlx_core_buf_active_recv ( struct nlx_core_domain lcdom,
struct nlx_core_transfer_mc lctm,
struct nlx_core_buffer lcbuf 
)

Enqueues a buffer for active bulk receive. The cb_match_bits field should be set to the value of the match bits of the remote passive buffer. The cb_addr field should be set with the end point address of the transfer machine with the passive buffer.

The invoker should ensure that the subroutine is not invoked concurrently with any of the other buffer operation initiation subroutines or the nlx_core_buf_event_get() subroutine.

The invoker should provision sufficient buffer event structures prior to the call, using the nlx_core_bevq_provision() subroutine.

Parameters
lcdomThe domain private data.
lctmTransfer machine private data.
lcbufBuffer private data.
Precondition
The buffer is queued on the specified transfer machine.
lcbuf->cb_length is valid
lcbuf->cb_match_bits != 0
lcbuf->cb_addr is valid
lcbuf->cb_max_operations == 1
See also
nlx_core_bevq_provision()

Definition at line 870 of file ulnet_core.c.

Here is the call graph for this function:

◆ nlx_core_buf_active_send()

M0_INTERNAL int nlx_core_buf_active_send ( struct nlx_core_domain lcdom,
struct nlx_core_transfer_mc lctm,
struct nlx_core_buffer lcbuf 
)

Enqueues a buffer for active bulk send. See nlx_core_buf_active_recv() for how the buffer is to be initialized.

The invoker should ensure that the subroutine is not invoked concurrently with any of the other buffer operation initiation subroutines or the nlx_core_buf_event_get() subroutine.

The invoker should provision sufficient buffer event structures prior to the call, using the nlx_core_bevq_provision() subroutine.

Parameters
lcdomThe domain private data.
lctmTransfer machine private data.
lcbufBuffer private data.
Precondition
The buffer is queued on the specified transfer machine.
lcbuf->cb_length is valid
lcbuf->cb_match_bits != 0
lcbuf->cb_addr is valid
lcbuf->cb_max_operations == 1
See also
nlx_core_bevq_provision()

Definition at line 890 of file ulnet_core.c.

Here is the call graph for this function:

◆ nlx_core_buf_del()

M0_INTERNAL int nlx_core_buf_del ( struct nlx_core_domain lcdom,
struct nlx_core_transfer_mc lctm,
struct nlx_core_buffer lcbuf 
)

Cancels a buffer operation if possible.

Parameters
lcdomThe domain private data.
lctmTransfer machine private data.
lcbufBuffer private data.
Precondition
The buffer is queued on the specified transfer machine.

Definition at line 950 of file ulnet_core.c.

Here is the call graph for this function:

◆ nlx_core_buf_deregister()

M0_INTERNAL void nlx_core_buf_deregister ( struct nlx_core_domain lcdom,
struct nlx_core_buffer lcbuf 
)

Deregisters the buffer.

Parameters
lcdomThe domain private data.
lcbufThe buffer private data.

Definition at line 792 of file ulnet_core.c.

Here is the call graph for this function:

◆ nlx_core_buf_event_wait()

int nlx_core_buf_event_wait ( struct nlx_core_domain lcdom,
struct nlx_core_transfer_mc lctm,
m0_time_t  timeout 
)

Waits for buffer events, or the timeout.

Parameters
lcdomDomain pointer.
lctmTransfer machine private data.
timeoutAbsolute time at which to stop waiting. A value of 0 indicates that the subroutine should not wait.
Return values
0Events present.
-ETIMEDOUTTimed out before events arrived.

Definition at line 960 of file ulnet_core.c.

Here is the call graph for this function:

◆ nlx_core_buf_msg_recv()

M0_INTERNAL int nlx_core_buf_msg_recv ( struct nlx_core_domain lcdom,
struct nlx_core_transfer_mc lctm,
struct nlx_core_buffer lcbuf 
)

Enqueues a buffer for message reception. Multiple messages may be received into the buffer, space permitting, up to the configured maximum.

The invoker should ensure that the subroutine is not invoked concurrently with any of the other buffer operation initiation subroutines or the nlx_core_buf_event_get() subroutine.

The invoker should provision sufficient buffer event structures prior to the call, using the nlx_core_bevq_provision() subroutine.

Parameters
lcdomThe domain private data.
lctmTransfer machine private data.
lcbufBuffer private data.
Precondition
lcbuf->cb_length is valid
lcbuf->cb_min_receive_size is valid
lcbuf->cb_max_operations > 0
See also
nlx_core_bevq_provision()

Definition at line 845 of file ulnet_core.c.

Here is the call graph for this function:

◆ nlx_core_buf_msg_send()

M0_INTERNAL int nlx_core_buf_msg_send ( struct nlx_core_domain lcdom,
struct nlx_core_transfer_mc lctm,
struct nlx_core_buffer lcbuf 
)

Enqueues a buffer for message transmission.

The invoker should ensure that the subroutine is not invoked concurrently with any of the other buffer operation initiation subroutines or the nlx_core_buf_event_get() subroutine.

The invoker should provision sufficient buffer event structures prior to the call, using the nlx_core_bevq_provision() subroutine.

Parameters
lcdomThe domain private data.
lctmTransfer machine private data.
lcbufBuffer private data.
Precondition
lcbuf->cb_length is valid
lcbuf->cb_addr is valid
lcbuf->cb_max_operations == 1
See also
nlx_core_bevq_provision()

Definition at line 858 of file ulnet_core.c.

Here is the call graph for this function:

◆ nlx_core_buf_passive_recv()

M0_INTERNAL int nlx_core_buf_passive_recv ( struct nlx_core_domain lcdom,
struct nlx_core_transfer_mc lctm,
struct nlx_core_buffer lcbuf 
)

Enqueues a buffer for passive bulk receive. The match bits for the passive buffer should be set in the buffer with the nlx_core_buf_desc_encode() subroutine before this call. It is guaranteed that the buffer can be remotely accessed when the subroutine returns.

The invoker should ensure that the subroutine is not invoked concurrently with any of the other buffer operation initiation subroutines or the nlx_core_buf_event_get() subroutine.

The invoker should provision sufficient buffer event structures prior to the call, using the nlx_core_bevq_provision() subroutine.

Parameters
lcdomThe domain private data.
lctmTransfer machine private data.
lcbufBuffer private data.
Precondition
The buffer is queued on the specified transfer machine.
lcbuf->cb_length is valid
lcbuf->cb_match_bits != 0
lcbuf->cb_max_operations == 1
See also
nlx_core_bevq_provision()

Definition at line 910 of file ulnet_core.c.

Here is the call graph for this function:

◆ nlx_core_buf_passive_send()

M0_INTERNAL int nlx_core_buf_passive_send ( struct nlx_core_domain lcdom,
struct nlx_core_transfer_mc lctm,
struct nlx_core_buffer lcbuf 
)

Enqueues a buffer for passive bulk send. See nlx_core_buf_passive_recv() for how the buffer is to be initialized. It is guaranteed that the buffer can be remotely accessed when the subroutine returns.

The invoker should ensure that the subroutine is not invoked concurrently with any of the other buffer operation initiation subroutines or the nlx_core_buf_event_get() subroutine.

The invoker should provision sufficient buffer event structures prior to the call, using the nlx_core_bevq_provision() subroutine.

Parameters
lcdomThe private data pointer for the domain.
lctmTransfer machine private data.
lcbufBuffer private data.
Precondition
The buffer is queued on the specified transfer machine.
lcbuf->cb_length is valid
lcbuf->cb_match_bits != 0
lcbuf->cb_max_operations == 1
See also
nlx_core_bevq_provision()

Definition at line 930 of file ulnet_core.c.

Here is the call graph for this function:

◆ nlx_core_buf_register()

M0_INTERNAL int nlx_core_buf_register ( struct nlx_core_domain lcdom,
nlx_core_opaque_ptr_t  buffer_id,
const struct m0_bufvec bvec,
struct nlx_core_buffer lcbuf 
)

Registers a network buffer. In user space this results in the buffer memory getting pinned. The subroutine allocates private data to associate with the network buffer.

Parameters
lcdomThe domain private data to be initialized.
buffer_idValue to set in the cb_buffer_id field.
bvecBuffer vector with core address space pointers.
lcbufThe core private data pointer for the buffer.

Definition at line 749 of file ulnet_core.c.

Here is the call graph for this function:

◆ nlx_core_dom_fini()

M0_INTERNAL void nlx_core_dom_fini ( struct nlx_core_domain lcdom)

Releases LNet transport resources related to the domain.

Definition at line 703 of file ulnet_core.c.

Here is the call graph for this function:

◆ nlx_core_dom_init()

M0_INTERNAL int nlx_core_dom_init ( struct m0_net_domain dom,
struct nlx_core_domain lcdom 
)

Allocates and initializes the network domain's private field for use by LNet.

Parameters
domThe network domain pointer.
lcdomThe private data pointer for the domain to be initialized.

Definition at line 633 of file ulnet_core.c.

Here is the call graph for this function:

◆ nlx_core_fini()

static void nlx_core_fini ( void  )
static

Definition at line 1211 of file ulnet_core.c.

◆ nlx_core_get_max_buffer_segment_size()

M0_INTERNAL m0_bcount_t nlx_core_get_max_buffer_segment_size ( struct nlx_core_domain lcdom)

Gets the maximum size of a buffer segment.

Definition at line 727 of file ulnet_core.c.

Here is the call graph for this function:

◆ nlx_core_get_max_buffer_segments()

M0_INTERNAL int32_t nlx_core_get_max_buffer_segments ( struct nlx_core_domain lcdom)

Gets the maximum number of buffer segments.

Definition at line 739 of file ulnet_core.c.

Here is the call graph for this function:

◆ nlx_core_get_max_buffer_size()

M0_INTERNAL m0_bcount_t nlx_core_get_max_buffer_size ( struct nlx_core_domain lcdom)

Gets the maximum buffer size (counting all segments).

Definition at line 717 of file ulnet_core.c.

Here is the call graph for this function:

◆ nlx_core_init()

static int nlx_core_init ( void  )
static

Definition at line 1216 of file ulnet_core.c.

◆ nlx_core_mem_alloc()

M0_INTERNAL void* nlx_core_mem_alloc ( size_t  size,
unsigned  shift 
)

Allocate zero-filled memory, like m0_alloc(). In user space, this memory is allocated such that it will not cross page boundaries using m0_alloc_aligned().

Parameters
sizeMemory size.
shiftAlignment, ignored in kernel space.
Precondition
size <= PAGE_SIZE

Definition at line 532 of file ulnet_core.c.

Here is the call graph for this function:

◆ nlx_core_mem_free()

M0_INTERNAL void nlx_core_mem_free ( void *  data,
size_t  size,
unsigned  shift 
)

Frees memory allocated by nlx_core_mem_alloc().

Definition at line 537 of file ulnet_core.c.

Here is the call graph for this function:

◆ nlx_core_new_blessed_bev()

M0_INTERNAL int nlx_core_new_blessed_bev ( struct nlx_core_domain lcdom,
struct nlx_core_transfer_mc lctm,
struct nlx_core_buffer_event **  bevp 
)

Subroutine to allocate a new buffer event structure initialized with the producer space self pointer set. This subroutine is defined separately for the kernel and user space.

Parameters
lcdomLNet core domain pointer.
lctmLNet core transfer machine pointer. In the user space transport this must be initialized at least with the core device driver file descriptor. In kernel space this is not used.
bevpBuffer event return pointer. The memory must be allocated with the NLX_ALLOC_PTR() macro or variant. It will be freed with the NLX_FREE_PTR() macro from the nlx_core_bev_free_cb() subroutine.
Postcondition
bev_cqueue_bless(&bevp->cbe_tm_link) has been invoked.
See also
bev_cqueue_bless()

Definition at line 1174 of file ulnet_core.c.

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

◆ nlx_core_nidstr_decode()

M0_INTERNAL int nlx_core_nidstr_decode ( struct nlx_core_domain lcdom,
const char *  nidstr,
uint64_t *  nid 
)

Decodes a NID string into a NID.

Parameters
lcdomThe domain private data.
nidstrthe string to be decoded.
nidOn success, the resulting NID is returned here.
Return values
-EINVALthe NID string could not be decoded

Definition at line 986 of file ulnet_core.c.

Here is the call graph for this function:

◆ nlx_core_nidstr_encode()

M0_INTERNAL int nlx_core_nidstr_encode ( struct nlx_core_domain lcdom,
uint64_t  nid,
char  nidstr[M0_NET_LNET_NIDSTR_SIZE] 
)

Encode a NID into its string representation.

Parameters
lcdomThe domain private data.
nidThe NID to be converted.
nidstrOn success, the string form is set here.

Definition at line 1009 of file ulnet_core.c.

Here is the call graph for this function:

◆ nlx_core_nidstrs_get()

M0_INTERNAL int nlx_core_nidstrs_get ( struct nlx_core_domain cd,
char ***  nidary 
)

Gets a list of strings corresponding to the local LNET network interfaces. The returned array must be released using nlx_core_nidstrs_put().

Parameters
lcdomDomain pointer.
nidaryA NULL-terminated (like argv) array of NID strings is returned.

Gets a list of strings corresponding to the local LNET network interfaces. The returned array must be released using nlx_core_nidstrs_put().

Parameters
nidaryA NULL-terminated (like argv) array of NID strings is returned.

Definition at line 1038 of file ulnet_core.c.

Here is the call graph for this function:

◆ nlx_core_nidstrs_put()

M0_INTERNAL void nlx_core_nidstrs_put ( struct nlx_core_domain lcdom,
char ***  nidary 
)

Releases the string array returned by nlx_core_nidstrs_get().

Definition at line 1049 of file ulnet_core.c.

Here is the call graph for this function:

◆ nlx_core_tm_start()

M0_INTERNAL int nlx_core_tm_start ( struct nlx_core_domain lcdom,
struct m0_net_transfer_mc tm,
struct nlx_core_transfer_mc lctm 
)

Starts a transfer machine. Internally this results in the creation of the LNet EQ associated with the transfer machine.

Parameters
lcdomThe domain private data.
tmThe transfer machine pointer.
lctmThe transfer machine private data to be initialized. The nlx_core_transfer_mc::ctm_addr must be set by the caller. If the lcpea_tmid field value is M0_NET_LNET_TMID_INVALID then a transfer machine identifier is dynamically assigned to the transfer machine and the nlx_core_transfer_mc::ctm_addr is modified in place.
Note
There is no equivalent of the xo_tm_init() subroutine.
This function does not create a m0_net_end_point for the transfer machine, because there is no equivalent object at the core layer.

Definition at line 1082 of file ulnet_core.c.

Here is the call graph for this function:

◆ nlx_core_tm_stop()

M0_INTERNAL void nlx_core_tm_stop ( struct nlx_core_domain lcdom,
struct nlx_core_transfer_mc lctm 
)

Stops the transfer machine and release associated resources. All operations must be finalized prior to this call.

Parameters
lcdomThe domain private data.
lctmThe transfer machine private data.
Note
There is no equivalent of the xo_tm_fini() subroutine.

Definition at line 1157 of file ulnet_core.c.

Here is the call graph for this function:

◆ nlx_ucore_buffer_invariant()

static bool nlx_ucore_buffer_invariant ( const struct nlx_ucore_buffer ub)
static

The nlx_ucore_buffer invariant.

Definition at line 519 of file ulnet_core.c.

Here is the caller graph for this function:

◆ nlx_ucore_domain_invariant()

static bool nlx_ucore_domain_invariant ( const struct nlx_ucore_domain ud)
static

Invariant for the nlx_ucore_domain structure.

Definition at line 507 of file ulnet_core.c.

Here is the caller graph for this function:

◆ nlx_ucore_ioctl()

static int nlx_ucore_ioctl ( int  fd,
unsigned long  cmd,
void *  arg 
)
static

Wrapper subroutine to invoke the driver ioctl() and map errno on failure to a valid return code.

Return values
>=0On success.
<0On failure.

Definition at line 548 of file ulnet_core.c.

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

◆ nlx_ucore_nidstrs_get()

static int nlx_ucore_nidstrs_get ( struct nlx_ucore_domain ud,
char ***  nidary 
)
static

Routine to fetch the NID strings from the device driver. The subroutine does not modify the domain private structure.

Parameters
udUcore domain. Only the fd field is required to be set.
nidaryA NULL-terminated (like argv) array of NID strings is returned.

Definition at line 579 of file ulnet_core.c.

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

◆ nlx_ucore_nidstrs_put()

static void nlx_ucore_nidstrs_put ( struct nlx_ucore_domain ud,
char ***  nidary 
)
static

Routine to release the strings allocated by nlx_ucore_nidstrs_get().

Definition at line 625 of file ulnet_core.c.

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

◆ nlx_ucore_tm_invariant()

static bool nlx_ucore_tm_invariant ( const struct nlx_ucore_transfer_mc utm)
static

The nlx_ucore_tm invariant.

Definition at line 527 of file ulnet_core.c.

Here is the caller graph for this function:

◆ nlx_ucore_tm_stop()

static void nlx_ucore_tm_stop ( struct nlx_core_domain cd,
struct nlx_core_transfer_mc ctm 
)
static

Subroutine to stop the TM in the kernel.

Definition at line 1063 of file ulnet_core.c.

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

Variable Documentation

◆ nlx_ucore_dev_name

const char* nlx_ucore_dev_name = "/dev/" M0_LNET_DEV
static

The name of the core device

Definition at line 502 of file ulnet_core.c.

◆ nlx_ucore_nidstrs_thunk

unsigned nlx_ucore_nidstrs_thunk = 128
static

Buffer (linear) increment size when fetching NID strings. Can be intercepted by unit tests.

Definition at line 570 of file ulnet_core.c.