mtcp_init

NAME
SYNOPSIS
DESCRIPTION
RETURN VALUE
NOTES
AUTHORS
SEE ALSO
COLOPHON

NAME

mtcp_init − initialize the mTCP stack.

SYNOPSIS

#include <mtcp_api.h>

int mtcp_init(char *config_file);

DESCRIPTION

mtcp_init() call is used to set the stack parameters of an mTCP-based application. These parameters are loaded inside the process via a startup configuration file. A developer is required to first call mtcp_init() function before he/she can invoke any follow-up mTCP functions in his/her application.

A user can populate an mTCP configuration file with the following parameters:

io

The underlying I/O driver he/she wants to use for his/her application. A user can specify either dpdk or psio (but not both) as the choice of the network I/O driver. Please note that psio is only supported for linux-2.6.32~linux-2.6.38 kernels.

num_cores

The number of cores one needs to use to run the mTCP application. Each core will spawn a pair of mTCP core thread and mTCP application thread. This variable is also used to set the number of RSS-based NIC hardware queues based on which traffic is split across different mTCP core threads in the application. It is assumed that each mTCP thread only reads from one hardware queue per NIC.

num_mem_ch

The number of memory channels that are currently inserted in the CPU per socket. Note that this option is used only for dpdk I/O driver. Default value is 0.

port

Space-separated NIC port(s) (specified as interface names) that will be used by the mTCP application.

max_concurrency

Maximum number of concurrent connections that can be accomodated by the mTCP stack per-core. Default value is 100000 connections per core.

rcvbuf

Receive buffer size of each mTCP socket. Default value is 8192 bytes.

sndbuf

Send buffer size of each mTCP socket. Default value is 8192 bytes.

tcp_timeout

TCP timeout (in seconds) of a connection. Default value is 30 seconds. Putting the value as -1 disables the timeout check.

tcp_timewait

TCP timewait value (in seconds). Default value is 0 seconds.

stat_print

Per-second traffic statistics printing of the specified interface.

RETURN VALUE

Returns 0 on success; -1 on failure.

NOTES

See config/sample_mtcp.conf to view example startup mTCP configuration file. Make sure that the mTCP configuration file has a specified I/O driver. Also make sure that num_mem_ch value is appropriately set when dpdk driver is being used.

AUTHORS

mTCP development team <[email protected]>

SEE ALSO

mtcp_destroy()

COLOPHON

This page is part of mTCP release 3.0 docs section. A description of the project, and information about reporting bugs, can be found at http://shader.kaist.edu/mtcp/.