Motr
M0
|
#include <net.h>
Data Fields | |
struct m0_bufvec | nb_buffer |
m0_bcount_t | nb_length |
m0_bindex_t | nb_offset |
struct m0_net_domain * | nb_dom |
struct m0_net_transfer_mc * | nb_tm |
enum m0_net_queue_type | nb_qtype |
const struct m0_net_buffer_callbacks * | nb_callbacks |
m0_time_t | nb_timeout |
m0_time_t | nb_add_time |
struct m0_net_buf_desc | nb_desc |
struct m0_net_end_point * | nb_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_pool * | nb_pool |
uint32_t | nb_msgs_received |
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.
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.
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.
struct m0_bufvec nb_buffer |
const struct m0_net_buffer_callbacks* nb_callbacks |
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.
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.
struct m0_list_link nb_dom_linkage |
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.
struct m0_tlink nb_extern_linkage |
uint64_t nb_flags |
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.
struct m0_tlink nb_lru |
uint32_t nb_max_receive_msgs |
m0_bcount_t nb_min_receive_size |
uint32_t nb_msgs_received |
m0_bindex_t nb_offset |
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.
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().
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.
struct m0_net_transfer_mc* nb_tm |
Transfer machine pointer. It is set automatically with every call to m0_net_buffer_add().
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.
void* nb_xprt_private |