Motr  M0
LNet Transport Device Internals

Detailed functional specification of the internals of the LNet Transport Device. More...

Collaboration diagram for LNet Transport Device Internals:

Functions

static int nlx_dev_ioctl_dom_init (struct nlx_kcore_domain *kd, struct m0_lnet_dev_dom_init_params *p)
 
static int nlx_dev_ioctl_buf_register (struct nlx_kcore_domain *kd, struct m0_lnet_dev_buf_register_params *p)
 
static void nlx_dev_buf_pages_unpin (const struct nlx_kcore_buffer *kb)
 
static int nlx_dev_buf_deregister (struct nlx_kcore_domain *kd, struct nlx_kcore_buffer *kb)
 
static int nlx_dev_ioctl_buf_deregister (struct nlx_kcore_domain *kd, struct m0_lnet_dev_buf_deregister_params *p)
 
static int nlx_dev_ioctl_buf_queue_op (const struct m0_lnet_dev_buf_queue_params *p, nlx_kcore_queue_op_t op)
 
static int nlx_dev_ioctl_buf_del (const struct nlx_kcore_domain *kd, const struct m0_lnet_dev_buf_queue_params *p)
 
static int nlx_dev_ioctl_buf_event_wait (const struct nlx_kcore_domain *kd, const struct m0_lnet_dev_buf_event_wait_params *p)
 
static int nlx_dev_ioctl_nidstr_decode (struct m0_lnet_dev_nid_encdec_params *p)
 
static int nlx_dev_ioctl_nidstr_encode (struct m0_lnet_dev_nid_encdec_params *p)
 
static int nlx_dev_ioctl_nidstrs_get (struct nlx_kcore_domain *kd, struct m0_lnet_dev_nidstrs_get_params *p)
 
static int nlx_dev_ioctl_tm_start (struct nlx_kcore_domain *kd, struct m0_lnet_dev_tm_start_params *p)
 
static int nlx_dev_tm_cleanup (struct nlx_kcore_domain *kd, struct nlx_kcore_transfer_mc *ktm)
 
static int nlx_dev_ioctl_tm_stop (struct nlx_kcore_domain *kd, struct m0_lnet_dev_tm_stop_params *p)
 
static int nlx_dev_ioctl_bev_bless (struct nlx_kcore_domain *kd, struct m0_lnet_dev_bev_bless_params *p)
 
static long nlx_dev_ioctl (struct file *file, unsigned int cmd, unsigned long arg)
 
static int nlx_dev_open (struct inode *inode, struct file *file)
 
M0_INTERNAL int nlx_dev_close (struct inode *inode, struct file *file)
 

Variables

static struct file_operations nlx_dev_file_ops
 
static struct miscdevice nlx_dev
 
static bool nlx_dev_registered = false
 

Detailed Description

Detailed functional specification of the internals of the LNet Transport Device.

See also
LNet Transport Device DLD and Logical Specification

Function Documentation

◆ nlx_dev_buf_deregister()

static int nlx_dev_buf_deregister ( struct nlx_kcore_domain kd,
struct nlx_kcore_buffer kb 
)
static

Deregisters a shared memory buffer from the kernel domain.

Parameters
kdThe kernel domain object.
kbThe kernel buffer object, freed upon return.

Definition at line 1012 of file klnet_drv.c.

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

◆ nlx_dev_buf_pages_unpin()

static void nlx_dev_buf_pages_unpin ( const struct nlx_kcore_buffer kb)
static

Unpins the pages referenced in a nlx_kcore_buffer::kb_kiov.

Parameters
kbThe kernel buffer object.

Definition at line 999 of file klnet_drv.c.

Here is the caller graph for this function:

◆ nlx_dev_close()

M0_INTERNAL int nlx_dev_close ( struct inode inode,
struct file file 
)

Releases all resources for the given struct file.

This operation is called once when the file is being released. There is a 1:1 correspondence between struct file objects and nlx_kcore_domain objects, so this operation will release all kernel resources for the domain. That can be expensive if the user process failed to release all transfer machines and buffers before closing the file.

Parameters
inodeDevice inode object.
fileFile object being released.

Definition at line 1527 of file klnet_drv.c.

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

◆ nlx_dev_ioctl()

static long nlx_dev_ioctl ( struct file file,
unsigned int  cmd,
unsigned long  arg 
)
static

Performs an unlocked (BKL is not held) ioctl request on the m0lnet device.

Precondition
nlx_kcore_domain_invariant(file->private_data)
Parameters
fileFile instance, corresponding to the nlx_kcore_domain.
cmdThe request or operation to perform.
argArgument to the operation, internally treated as a pointer whose type depends on the cmd.

Definition at line 1372 of file klnet_drv.c.

Here is the call graph for this function:

◆ nlx_dev_ioctl_bev_bless()

static int nlx_dev_ioctl_bev_bless ( struct nlx_kcore_domain kd,
struct m0_lnet_dev_bev_bless_params p 
)
static

Blesses a shared nlx_core_buffer_event object. The shared buffer event object is pinned in kernel space and its nlx_core_buffer_event::cbe_kpvt field is set. The bev_link_bless() function is used to bless the nlx_core_buffer_event::cbe_tm_link.

Parameters
kdThe kernel domain object.
pIoctl request parameters.

Definition at line 1310 of file klnet_drv.c.

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

◆ nlx_dev_ioctl_buf_del()

static int nlx_dev_ioctl_buf_del ( const struct nlx_kcore_domain kd,
const struct m0_lnet_dev_buf_queue_params p 
)
static

Cancels a buffer operation if possible.

Parameters
kdThe kernel domain object.
pIoctl request parameters.

Definition at line 1083 of file klnet_drv.c.

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

◆ nlx_dev_ioctl_buf_deregister()

static int nlx_dev_ioctl_buf_deregister ( struct nlx_kcore_domain kd,
struct m0_lnet_dev_buf_deregister_params p 
)
static

Deregisters a shared memory buffer from the kernel domain.

Parameters
kdThe kernel domain object.
pIoctl request parameters.

Definition at line 1036 of file klnet_drv.c.

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

◆ nlx_dev_ioctl_buf_event_wait()

static int nlx_dev_ioctl_buf_event_wait ( const struct nlx_kcore_domain kd,
const struct m0_lnet_dev_buf_event_wait_params p 
)
static

Waits for buffer events, or the timeout.

Parameters
kdThe kernel domain object.
pIoctl request parameters.

Definition at line 1103 of file klnet_drv.c.

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

◆ nlx_dev_ioctl_buf_queue_op()

static int nlx_dev_ioctl_buf_queue_op ( const struct m0_lnet_dev_buf_queue_params p,
nlx_kcore_queue_op_t  op 
)
static

Enqueues a buffer on the appropriate transfer machine queue.

Parameters
pIoctl request parameters.
opBuffer queue operation to perform.

Definition at line 1052 of file klnet_drv.c.

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

◆ nlx_dev_ioctl_buf_register()

static int nlx_dev_ioctl_buf_register ( struct nlx_kcore_domain kd,
struct m0_lnet_dev_buf_register_params p 
)
static

Registers a shared memory buffer with the kernel domain.

Parameters
kdThe kernel domain object.
pIoctl request parameters.

Definition at line 901 of file klnet_drv.c.

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

◆ nlx_dev_ioctl_dom_init()

static int nlx_dev_ioctl_dom_init ( struct nlx_kcore_domain kd,
struct m0_lnet_dev_dom_init_params p 
)
static

Completes the kernel initialization of the kernel and shared core domain objects. The user domain object is mapped into kernel space and its nlx_core_domain::cd_kpvt field is set.

Parameters
kdThe kernel domain object.
pIoctl request parameters. The buffer size maximum fields are set on success.

Definition at line 853 of file klnet_drv.c.

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

◆ nlx_dev_ioctl_nidstr_decode()

static int nlx_dev_ioctl_nidstr_decode ( struct m0_lnet_dev_nid_encdec_params p)
static

Decodes a NID string into a NID.

Parameters
pIoctl request parameters. The m0_lnet_dev_nid_encdec_params::dn_nid field is set on success.

Definition at line 1129 of file klnet_drv.c.

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

◆ nlx_dev_ioctl_nidstr_encode()

static int nlx_dev_ioctl_nidstr_encode ( struct m0_lnet_dev_nid_encdec_params p)
static

Encodes a NID into a NID string.

Parameters
pIoctl request parameters. The m0_lnet_dev_nid_encdec_params::dn_buf field is set on success.

Definition at line 1139 of file klnet_drv.c.

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

◆ nlx_dev_ioctl_nidstrs_get()

static int nlx_dev_ioctl_nidstrs_get ( struct nlx_kcore_domain kd,
struct m0_lnet_dev_nidstrs_get_params p 
)
static

Gets the NID strings of all the local LNet interfaces. The NID strings are encoded consecutively in user space buffer denoted by the m0_lnet_dev_nidstrs_get_params::dng_buf field as a sequence nul terminated strings, with an final nul (string) terminating the list.

Parameters
kdThe kernel domain object.
pIoctl request parameters.
Return values
-EFBIGif the strings do not fit in the provided buffer.

Definition at line 1153 of file klnet_drv.c.

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

◆ nlx_dev_ioctl_tm_start()

static int nlx_dev_ioctl_tm_start ( struct nlx_kcore_domain kd,
struct m0_lnet_dev_tm_start_params p 
)
static

Completes the kernel portion of the TM start logic. The shared transfer machine object is pinned in kernel space and its nlx_core_transfer_mc::ctm_kpvt field is set.

Parameters
kdThe kernel domain object.
pIoctl request parameters.

Definition at line 1197 of file klnet_drv.c.

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

◆ nlx_dev_ioctl_tm_stop()

static int nlx_dev_ioctl_tm_stop ( struct nlx_kcore_domain kd,
struct m0_lnet_dev_tm_stop_params p 
)
static

Complete the kernel portion of the TM stop logic.

Parameters
kdThe kernel domain object.
pIoctl request parameters.

Definition at line 1291 of file klnet_drv.c.

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

◆ nlx_dev_open()

static int nlx_dev_open ( struct inode inode,
struct file file 
)
static

Open the /dev/m0lnet device.

There is a 1:1 correspondence between struct file objects and nlx_kcore_domain objects. Thus, user processes will open the m0lnet device once for each m0_net_domain.

Parameters
inodeInode object for the device.
fileFile object for this instance.

Definition at line 1494 of file klnet_drv.c.

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

◆ nlx_dev_tm_cleanup()

static int nlx_dev_tm_cleanup ( struct nlx_kcore_domain kd,
struct nlx_kcore_transfer_mc ktm 
)
static

Helper for nlx_dev_close() and nlx_dev_ioctl_tm_stop() to clean up kernel resources associated with an individual transfer machine.

Parameters
kdThe kernel domain object.
ktmThe kernel transfer machine object, removed from the kd->kd_drv_tms and freed upon return.
Todo:
XXX list removal is protected by the lock, but iteration over the list isn't? –nikita.

Definition at line 1254 of file klnet_drv.c.

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

Variable Documentation

◆ nlx_dev

struct miscdevice nlx_dev
static
Initial value:
= {
.minor = MISC_DYNAMIC_MINOR,
.name = M0_LNET_DEV,
}
static struct file_operations nlx_dev_file_ops
Definition: klnet_drv.c:1613
#define M0_LNET_DEV
Definition: lnet_ioctl.h:164

Device description. The device is named /dev/m0lnet when nlx_dev_init() completes. The major number is 10 (misc), and the minor number is assigned dynamically when misc_register() is called.

Definition at line 1626 of file klnet_drv.c.

◆ nlx_dev_file_ops

struct file_operations nlx_dev_file_ops
static
Initial value:
= {
.owner = THIS_MODULE,
.unlocked_ioctl = nlx_dev_ioctl,
.open = nlx_dev_open,
.release = nlx_dev_close
}
M0_INTERNAL int nlx_dev_close(struct inode *inode, struct file *file)
Definition: klnet_drv.c:1527
static int nlx_dev_open(struct inode *inode, struct file *file)
Definition: klnet_drv.c:1494
static long nlx_dev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
Definition: klnet_drv.c:1372

File operations for the m0lnet device, UT can override.

Definition at line 1613 of file klnet_drv.c.

◆ nlx_dev_registered

bool nlx_dev_registered = false
static

Definition at line 1631 of file klnet_drv.c.