Motr  M0
rpc_machine.c File Reference
#include "lib/trace.h"
#include "lib/misc.h"
#include "lib/memory.h"
#include "lib/errno.h"
#include "lib/finject.h"
#include "addb2/addb2.h"
#include "motr/magic.h"
#include "cob/cob.h"
#include "net/net.h"
#include "net/buffer_pool.h"
#include "reqh/reqh.h"
#include "rpc/addb2.h"
#include "rpc/rpc_internal.h"
#include "net/lnet/lnet.h"
Include dependency graph for rpc_machine.c:

Go to the source code of this file.

Data Structures

struct  rpc_conn_holder
 

Macros

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_RPC
 

Enumerations

enum  { DRAIN_INTERVAL = M0_MKTIME(5, 0), DRAIN_MAX = 128 }
 

Functions

static void rpc_tm_cleanup (struct m0_rpc_machine *machine)
 
static int rpc_tm_setup (struct m0_net_transfer_mc *tm, struct m0_net_domain *net_dom, const char *ep_addr, struct m0_net_buffer_pool *pool, uint32_t colour, m0_bcount_t msg_size, uint32_t qlen)
 
static int __rpc_machine_init (struct m0_rpc_machine *machine)
 
static void __rpc_machine_fini (struct m0_rpc_machine *machine)
 
M0_INTERNAL void rpc_worker_thread_fn (struct m0_rpc_machine *machine)
 
static struct m0_rpc_chanrpc_chan_locate (struct m0_rpc_machine *machine, struct m0_net_end_point *dest_ep)
 
static int rpc_chan_create (struct m0_rpc_chan **chan, struct m0_rpc_machine *machine, struct m0_net_end_point *dest_ep, uint64_t max_packets_in_flight)
 
static void rpc_chan_ref_release (struct m0_ref *ref)
 
static void rpc_recv_pool_buffer_put (struct m0_net_buffer *nb)
 
static void buf_recv_cb (const struct m0_net_buffer_event *ev)
 
static void net_buf_received (struct m0_net_buffer *nb, m0_bindex_t offset, m0_bcount_t length, struct m0_net_end_point *from_ep)
 
static void packet_received (struct m0_rpc_packet *p, struct m0_rpc_machine *machine, struct m0_net_end_point *from_ep)
 
static void item_received (struct m0_rpc_item *item, struct m0_net_end_point *from_ep)
 
static void net_buf_err (struct m0_net_buffer *nb, int32_t status)
 
 M0_BOB_DEFINE (, &rpc_machine_bob_type, m0_rpc_machine)
 
 M0_TL_DESCR_DEFINE (rpc_chan, "rpc_channels", static, struct m0_rpc_chan, rc_linkage, rc_magic, M0_RPC_CHAN_MAGIC, M0_RPC_CHAN_HEAD_MAGIC)
 
 M0_TL_DEFINE (rpc_chan, static, struct m0_rpc_chan)
 
 M0_TL_DESCR_DEFINE (rmach_watch, "rpc_machine_watch", M0_INTERNAL, struct m0_rpc_machine_watch, mw_linkage, mw_magic, M0_RPC_MACHINE_WATCH_MAGIC, M0_RPC_MACHINE_WATCH_HEAD_MAGIC)
 
 M0_TL_DEFINE (rmach_watch, M0_INTERNAL, struct m0_rpc_machine_watch)
 
 M0_TL_DESCR_DEFINE (rpc_conn, "rpc-conn", M0_INTERNAL, struct m0_rpc_conn, c_link, c_magic, M0_RPC_CONN_MAGIC, M0_RPC_CONN_HEAD_MAGIC)
 
 M0_TL_DEFINE (rpc_conn, M0_INTERNAL, struct m0_rpc_conn)
 
static void rpc_tm_event_cb (const struct m0_net_tm_event *ev)
 
M0_INTERNAL int m0_rpc_machine_init (struct m0_rpc_machine *machine, struct m0_net_domain *net_dom, const char *ep_addr, struct m0_reqh *reqh, struct m0_net_buffer_pool *receive_pool, uint32_t colour, m0_bcount_t msg_size, uint32_t queue_len)
 
static void machine_nb_idle (struct m0_rpc_machine *machine)
 
void m0_rpc_machine_fini (struct m0_rpc_machine *machine)
 
static bool rpc_conn__on_finalised_cb (struct m0_clink *clink)
 
M0_INTERNAL void m0_rpc_machine_cleanup_incoming_connections (struct m0_rpc_machine *machine)
 
M0_INTERNAL void m0_rpc_machine_drain_item_sources (struct m0_rpc_machine *machine, uint32_t max_per_source)
 
static struct m0_rpc_machinetm_to_rpc_machine (const struct m0_net_transfer_mc *tm)
 
M0_INTERNAL void m0_rpc_machine_lock (struct m0_rpc_machine *machine)
 
M0_INTERNAL void m0_rpc_machine_unlock (struct m0_rpc_machine *machine)
 
M0_INTERNAL bool m0_rpc_machine_is_locked (const struct m0_rpc_machine *machine)
 
M0_INTERNAL bool m0_rpc_machine_is_not_locked (const struct m0_rpc_machine *machine)
 
static void __rpc_machine_get_stats (struct m0_rpc_machine *machine, struct m0_rpc_stats *stats, bool reset)
 
void m0_rpc_machine_get_stats (struct m0_rpc_machine *machine, struct m0_rpc_stats *stats, bool reset)
 
M0_INTERNAL const char * m0_rpc_machine_ep (const struct m0_rpc_machine *rmach)
 
M0_INTERNAL void m0_rpc_machine_add_conn (struct m0_rpc_machine *rmach, struct m0_rpc_conn *conn)
 
M0_INTERNAL struct m0_rpc_chanrpc_chan_get (struct m0_rpc_machine *machine, struct m0_net_end_point *dest_ep, uint64_t max_packets_in_flight)
 
M0_INTERNAL void rpc_chan_put (struct m0_rpc_chan *chan)
 
M0_INTERNAL struct m0_rpc_connm0_rpc_machine_find_conn (const struct m0_rpc_machine *machine, const struct m0_rpc_item *item)
 
static bool item_received_fi (struct m0_rpc_item *item)
 
void m0_rpc_machine_watch_attach (struct m0_rpc_machine_watch *watch)
 
void m0_rpc_machine_watch_detach (struct m0_rpc_machine_watch *watch)
 

Variables

static const struct m0_bob_type rpc_machine_bob_type
 
static const struct m0_net_buffer_callbacks rpc_buf_recv_cb
 
static struct m0_net_tm_callbacks m0_rpc_tm_callbacks
 
M0_INTERNAL void(* m0_rpc__item_dropped )(struct m0_rpc_item *item)
 
uint32_t m0_rpc__filter_opcode [4] = {}