Motr  M0
network.c File Reference
#include <unistd.h>
#include "ut/ut.h"
#include "lib/misc.h"
#include "lib/semaphore.h"
#include "lib/memory.h"
#include "net/lnet/lnet.h"
#include "net/test/network.h"
Include dependency graph for network.c:

Go to the source code of this file.

Enumerations

enum  { NET_TEST_PING_BUF_SIZE = 4096, NET_TEST_PING_BUF_STEP = 511, NET_TEST_BULK_BUF_SIZE = 1024 * 1024, NET_TEST_BUF_DESC_NR = 10 }
 

Functions

static m0_bcount_t bv_copy (struct m0_bufvec *dst, struct m0_bufvec *src, m0_bcount_t len)
 
static bool net_buf_data_eq (enum m0_net_test_network_buf_type buf_type, struct m0_net_test_network_ctx *ctx1, uint32_t buf_index1, struct m0_net_test_network_ctx *ctx2, uint32_t buf_index2)
 
static void ping_tm_event_cb (const struct m0_net_tm_event *ev)
 
static void ping_cb_msg_recv (struct m0_net_test_network_ctx *ctx, const uint32_t buf_index, enum m0_net_queue_type q, const struct m0_net_buffer_event *ev)
 
static void ping_cb_msg_send (struct m0_net_test_network_ctx *ctx, const uint32_t buf_index, enum m0_net_queue_type q, const struct m0_net_buffer_event *ev)
 
static void ping_cb_impossible (struct m0_net_test_network_ctx *ctx, const uint32_t buf_index, enum m0_net_queue_type q, const struct m0_net_buffer_event *ev)
 
void m0_net_test_network_ut_ping (void)
 
static void bulk_cb (struct m0_net_test_network_ctx *ctx, const uint32_t buf_index, enum m0_net_queue_type q, const struct m0_net_buffer_event *ev)
 
void m0_net_test_network_ut_bulk (void)
 
static void tm_event_cb_empty (const struct m0_net_tm_event *ev)
 
static void cb_empty (struct m0_net_test_network_ctx *ctx, const uint32_t buf_index, enum m0_net_queue_type q, const struct m0_net_buffer_event *ev)
 
static bool buf_desc_eq (struct m0_net_test_network_ctx *ctx1, uint32_t buf_index1, struct m0_net_test_network_ctx *ctx2, uint32_t buf_index2)
 
static void multiple_buf_desc_encode_decode (struct m0_net_test_network_ctx *ctx, int count)
 
void m0_net_test_network_ut_buf_desc (void)
 
void m0_net_test_network_ut_addr_decode (void)
 

Variables

static struct m0_semaphore recv_sem
 
static struct m0_semaphore send_sem
 
static const struct m0_net_tm_callbacks ping_tm_cb
 
static struct m0_net_test_network_buffer_callbacks ping_buf_cb
 
static struct m0_semaphore bulk_cb_sem [M0_NET_QT_NR]
 
static bool bulk_offset_mismatch
 
static const struct m0_net_tm_callbacks bulk_tm_cb
 
static struct m0_net_test_network_buffer_callbacks bulk_buf_cb
 
static const struct m0_net_tm_callbacks tm_cb_empty
 
static struct m0_net_test_network_buffer_callbacks buf_cb_empty
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
NET_TEST_PING_BUF_SIZE 
NET_TEST_PING_BUF_STEP 
NET_TEST_BULK_BUF_SIZE 
See also
m0_net_test_network_ut_ping
NET_TEST_BUF_DESC_NR 

Definition at line 34 of file network.c.

Function Documentation

◆ buf_desc_eq()

static bool buf_desc_eq ( struct m0_net_test_network_ctx ctx1,
uint32_t  buf_index1,
struct m0_net_test_network_ctx ctx2,
uint32_t  buf_index2 
)
static

Compare bulk network buffer descriptors.

Definition at line 399 of file network.c.

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

◆ bulk_cb()

static void bulk_cb ( struct m0_net_test_network_ctx ctx,
const uint32_t  buf_index,
enum m0_net_queue_type  q,
const struct m0_net_buffer_event ev 
)
static

Definition at line 212 of file network.c.

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

◆ bv_copy()

static m0_bcount_t bv_copy ( struct m0_bufvec dst,
struct m0_bufvec src,
m0_bcount_t  len 
)
static

Definition at line 41 of file network.c.

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

◆ cb_empty()

static void cb_empty ( struct m0_net_test_network_ctx ctx,
const uint32_t  buf_index,
enum m0_net_queue_type  q,
const struct m0_net_buffer_event ev 
)
static

Definition at line 374 of file network.c.

◆ m0_net_test_network_ut_addr_decode()

void m0_net_test_network_ut_addr_decode ( void  )

TODO: decode: corrupted FQDN of type tcp/verbs Currently it is assumed that if FQDN resoultion fails, then by default ip format is used.

memset(&ep_str, 0, sizeof(ep_str)); sprintf(ep_str, "inet:tcp:%s@3005", &hostname[4]); rc = m0_net_test_network_ep_add(&send, ep_str); M0_UT_ASSERT(rc == -EPROTO);

memset(&ep_str, 0, sizeof(ep_str)); sprintf(ep_str, "inet:verbs:%s@3006", &hostname[4]); rc = m0_net_test_network_ep_add(&send, ep_str); M0_UT_ASSERT(rc == -EPROTO);

Definition at line 503 of file network.c.

Here is the call graph for this function:

◆ m0_net_test_network_ut_buf_desc()

void m0_net_test_network_ut_buf_desc ( void  )

Definition at line 453 of file network.c.

Here is the call graph for this function:

◆ m0_net_test_network_ut_bulk()

void m0_net_test_network_ut_bulk ( void  )

Definition at line 244 of file network.c.

Here is the call graph for this function:

◆ m0_net_test_network_ut_ping()

void m0_net_test_network_ut_ping ( void  )
Todo:
timeddown

Definition at line 141 of file network.c.

Here is the call graph for this function:

◆ multiple_buf_desc_encode_decode()

static void multiple_buf_desc_encode_decode ( struct m0_net_test_network_ctx ctx,
int  count 
)
static

Definition at line 418 of file network.c.

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

◆ net_buf_data_eq()

static bool net_buf_data_eq ( enum m0_net_test_network_buf_type  buf_type,
struct m0_net_test_network_ctx ctx1,
uint32_t  buf_index1,
struct m0_net_test_network_ctx ctx2,
uint32_t  buf_index2 
)
static
Todo:
too expensive, use m0_bufvec_cursor_step() + memcmp()

Definition at line 54 of file network.c.

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

◆ ping_cb_impossible()

static void ping_cb_impossible ( struct m0_net_test_network_ctx ctx,
const uint32_t  buf_index,
enum m0_net_queue_type  q,
const struct m0_net_buffer_event ev 
)
static

Definition at line 117 of file network.c.

◆ ping_cb_msg_recv()

static void ping_cb_msg_recv ( struct m0_net_test_network_ctx ctx,
const uint32_t  buf_index,
enum m0_net_queue_type  q,
const struct m0_net_buffer_event ev 
)
static

Definition at line 101 of file network.c.

Here is the call graph for this function:

◆ ping_cb_msg_send()

static void ping_cb_msg_send ( struct m0_net_test_network_ctx ctx,
const uint32_t  buf_index,
enum m0_net_queue_type  q,
const struct m0_net_buffer_event ev 
)
static

Definition at line 109 of file network.c.

Here is the call graph for this function:

◆ ping_tm_event_cb()

static void ping_tm_event_cb ( const struct m0_net_tm_event ev)
static

Definition at line 94 of file network.c.

◆ tm_event_cb_empty()

static void tm_event_cb_empty ( const struct m0_net_tm_event ev)
static

Definition at line 370 of file network.c.

Variable Documentation

◆ buf_cb_empty

struct m0_net_test_network_buffer_callbacks buf_cb_empty
static
Initial value:
= {
.ntnbc_cb = {
}
}
static void cb_empty(struct m0_net_test_network_ctx *ctx, const uint32_t buf_index, enum m0_net_queue_type q, const struct m0_net_buffer_event *ev)
Definition: network.c:374

Definition at line 385 of file network.c.

◆ bulk_buf_cb

struct m0_net_test_network_buffer_callbacks bulk_buf_cb
static
Initial value:
= {
.ntnbc_cb = {
}
}
static void bulk_cb(struct m0_net_test_network_ctx *ctx, const uint32_t buf_index, enum m0_net_queue_type q, const struct m0_net_buffer_event *ev)
Definition: network.c:212

Definition at line 233 of file network.c.

◆ bulk_cb_sem

struct m0_semaphore bulk_cb_sem[M0_NET_QT_NR]
static

Definition at line 209 of file network.c.

◆ bulk_offset_mismatch

bool bulk_offset_mismatch
static

Definition at line 210 of file network.c.

◆ bulk_tm_cb

const struct m0_net_tm_callbacks bulk_tm_cb
static
Initial value:
= {
.ntc_event_cb = ping_tm_event_cb
}
static void ping_tm_event_cb(const struct m0_net_tm_event *ev)
Definition: network.c:94

Definition at line 229 of file network.c.

◆ ping_buf_cb

struct m0_net_test_network_buffer_callbacks ping_buf_cb
static
Initial value:
= {
.ntnbc_cb = {
}
}
static void ping_cb_msg_recv(struct m0_net_test_network_ctx *ctx, const uint32_t buf_index, enum m0_net_queue_type q, const struct m0_net_buffer_event *ev)
Definition: network.c:101
static void ping_cb_impossible(struct m0_net_test_network_ctx *ctx, const uint32_t buf_index, enum m0_net_queue_type q, const struct m0_net_buffer_event *ev)
Definition: network.c:117
static void ping_cb_msg_send(struct m0_net_test_network_ctx *ctx, const uint32_t buf_index, enum m0_net_queue_type q, const struct m0_net_buffer_event *ev)
Definition: network.c:109

Definition at line 130 of file network.c.

◆ ping_tm_cb

const struct m0_net_tm_callbacks ping_tm_cb
static
Initial value:
= {
.ntc_event_cb = ping_tm_event_cb
}
static void ping_tm_event_cb(const struct m0_net_tm_event *ev)
Definition: network.c:94

Definition at line 126 of file network.c.

◆ recv_sem

struct m0_semaphore recv_sem
static

Definition at line 98 of file network.c.

◆ send_sem

struct m0_semaphore send_sem
static

Definition at line 99 of file network.c.

◆ tm_cb_empty

const struct m0_net_tm_callbacks tm_cb_empty
static
Initial value:
= {
.ntc_event_cb = tm_event_cb_empty
}
static void tm_event_cb_empty(const struct m0_net_tm_event *ev)
Definition: network.c:370

Definition at line 381 of file network.c.