Motr  M0
m0_net_buffer Struct Reference

#include <net.h>

Collaboration diagram for m0_net_buffer:
Collaboration graph

Data Fields

struct m0_bufvec nb_buffer
 
m0_bcount_t nb_length
 
m0_bindex_t nb_offset
 
struct m0_net_domainnb_dom
 
struct m0_net_transfer_mcnb_tm
 
enum m0_net_queue_type nb_qtype
 
const struct m0_net_buffer_callbacksnb_callbacks
 
m0_time_t nb_timeout
 
m0_time_t nb_add_time
 
struct m0_net_buf_desc nb_desc
 
struct m0_net_end_pointnb_ep
 
struct m0_tlink nb_tm_linkage
 
struct m0_tlink nb_lru
 
struct m0_tlink nb_extern_linkage
 
uint64_t nb_magic
 
struct m0_list_link nb_dom_linkage
 
void * nb_xprt_private
 
void * nb_app_private
 
uint64_t nb_flags
 
m0_bcount_t nb_min_receive_size
 
uint32_t nb_max_receive_msgs
 
struct m0_net_buffer_poolnb_pool
 
uint32_t nb_msgs_received
 

Detailed Description

This data structure is used to track the memory used for message passing or bulk data transfer over the network.

Support for scatter-gather buffers is provided by use of a m0_bufvec; upper layer protocols may impose limitations on the use of scatter-gather, especially for message passing. The transport will impose limitations on the number of vector elements and the overall maximum buffer size.

The invoking application is responsible for the creation of these data structures, registering them with the network domain, and providing them to a transfer machine for specific operations. As such, memory alignment considerations of the encapsulated m0_bufvec are handled by the invoking application.

Once the application initiates an operation on a buffer, it should refrain from modifying the buffer until the callback signifying operation completion.

Applications must register buffers with the transport before use, and deregister them before shutting down.

Definition at line 1316 of file net.h.

Field Documentation

◆ nb_add_time

m0_time_t nb_add_time

Time at which the buffer was added to its logical queue. Set by the m0_net_buffer_add() subroutine and used to compute the time spent in the queue.

Definition at line 1394 of file net.h.

◆ nb_app_private

void* nb_app_private

Application specific private data associated with the buffer. It is populated and used by the end user. It is end user's responsibility to use this field to allocate or deallocate any memory regions stored in this field.

It is neither verified by net code nor do the net layer invariants touch it.

Current users:

- rpc/bulk uses this for a pointer to m0_rpc_bulk_buf;
- net/test uses this for a pointer to m0_net_test_network_ctx.

Definition at line 1477 of file net.h.

◆ nb_buffer

struct m0_bufvec nb_buffer

Vector pointing to memory associated with this data structure. Initialized by the application prior to registration. It should not be modified until after registration.

Definition at line 1322 of file net.h.

◆ nb_callbacks

const struct m0_net_buffer_callbacks* nb_callbacks

Pointer to application callbacks. Should be set prior to adding the buffer to a transfer machine queue.

Definition at line 1369 of file net.h.

◆ nb_desc

struct m0_net_buf_desc nb_desc

Network transport descriptor.

The value is set upon return from m0_net_buffer_add() when the buffer is added to the M0_NET_QT_PASSIVE_BULK_RECV or M0_NET_QT_PASSIVE_BULK_SEND queues.

Applications should convey the descriptor to the active side to perform the bulk data transfer. The active side application code should set this value when adding the buffer to the M0_NET_QT_ACTIVE_BULK_RECV or M0_NET_QT_ACTIVE_BULK_SEND queues, using the m0_net_desc_copy() subroutine.

In both cases, applications are responsible for freeing the memory used by this descriptor with the m0_net_desc_free() subroutine.

Definition at line 1412 of file net.h.

◆ nb_dom

struct m0_net_domain* nb_dom

Domain pointer. It is set automatically when the buffer is registered with m0_net_buffer_register(). The application should not modify this field.

Definition at line 1351 of file net.h.

◆ nb_dom_linkage

struct m0_list_link nb_dom_linkage

Linkage into one of the domain list that tracks registered buffers.

The application should not modify this field.

Definition at line 1453 of file net.h.

◆ nb_ep

struct m0_net_end_point* nb_ep

This field identifies an end point in the associated transfer machine.

When sending messages the application should specify the end point of the destination before adding the buffer to the M0_NET_QT_MSG_SEND queue.

The field is not used for the bulk cases nor for received messages.

Definition at line 1424 of file net.h.

◆ nb_extern_linkage

struct m0_tlink nb_extern_linkage

Application-specific buffer linkage.

Definition at line 1443 of file net.h.

◆ nb_flags

uint64_t nb_flags

Buffer state is tracked with bitmap flags from enum m0_net_buf_flags.

The application should initialize this field to 0 prior to registering the buffer with the domain.

The application should not modify these flags again until after de-registration.

Definition at line 1489 of file net.h.

◆ nb_length

m0_bcount_t nb_length

The actual amount of data to be transferred in the case of adding the buffer to the M0_NET_QT_MSG_SEND, M0_NET_QT_PASSIVE_BULK_SEND or M0_NET_QT_ACTIVE_BULK_SEND queues.

The actual amount of valid data received, upon completion of M0_NET_QT_MSG_RECV, M0_NET_QT_PASSIVE_BULK_RECV or M0_NET_QT_ACTIVE_BULK_RECV queue operations, is not set here, but in the nbe_length field of the m0_net_buffer_event instead.

Definition at line 1334 of file net.h.

◆ nb_lru

struct m0_tlink nb_lru

Linkage into a network buffer pool LRU list.

Definition at line 1440 of file net.h.

◆ nb_magic

uint64_t nb_magic

Magic for network buffer list.

Definition at line 1446 of file net.h.

◆ nb_max_receive_msgs

uint32_t nb_max_receive_msgs

Maximum number of messages that may be received in the buffer. The value may not be 0 for buffers in the M0_NET_QT_MSG_RECV queue.

Definition at line 1502 of file net.h.

◆ nb_min_receive_size

m0_bcount_t nb_min_receive_size

Minimum remaining size in a receive buffer to allow reuse for multiple messages. The value may not be 0 for buffers in the M0_NET_QT_MSG_RECV queue.

Definition at line 1496 of file net.h.

◆ nb_msgs_received

uint32_t nb_msgs_received

Counts the number of messages received when on the receive queue.

Definition at line 1511 of file net.h.

◆ nb_offset

m0_bindex_t nb_offset

The starting offset in the buffer from which the data should be read, in the case of adding a buffer to the M0_NET_QT_MSG_SEND, M0_NET_QT_PASSIVE_BULK_SEND or M0_NET_QT_ACTIVE_BULK_SEND queues.

It is transport specific if a non-zero value is supported.

Definition at line 1344 of file net.h.

◆ nb_pool

struct m0_net_buffer_pool* nb_pool

Set when a buffer is provisioned from a pool using the m0_net_buffer_pool_get() subroutine call.

Definition at line 1508 of file net.h.

◆ nb_qtype

enum m0_net_queue_type nb_qtype

The application should set this value to identify the logical transfer machine queue before calling m0_net_buffer_add().

Definition at line 1363 of file net.h.

◆ nb_timeout

m0_time_t nb_timeout

Absolute time by which an operation involving the buffer should stop with failure if not completed. The application should set this field prior to adding the buffer to a transfer machine logical queue.

Support for this is transport specific. A value of M0_TIME_NEVER disables the timeout. The value is forced to M0_TIME_NEVER during buffer registration, and reset to the same prior to the invocation of the buffer callback so applications need not bother with this field unless they intend to set a timeout value.

Adding a buffer to a logical queue will fail with a -ETIME error code if the specified nb_timeout value is in the past.

Definition at line 1387 of file net.h.

◆ nb_tm

struct m0_net_transfer_mc* nb_tm

Transfer machine pointer. It is set automatically with every call to m0_net_buffer_add().

Definition at line 1357 of file net.h.

◆ nb_tm_linkage

struct m0_tlink nb_tm_linkage

Linkage into one of the transfer machine lists that implement the logical queues. There is only one linkage for all of the queues, as a buffer can only be used for one type of operation at a time.

For free pool buffers, it is also used for linkage into m0_net_buffer_pool::nbp_colours[].

The application should not modify this field.

Definition at line 1437 of file net.h.

◆ nb_xprt_private

void* nb_xprt_private

Transport private data associated with the buffer. Will be freed when the buffer is deregistered, if not earlier.

The application should not modify this field.

Definition at line 1461 of file net.h.


The documentation for this struct was generated from the following file: