mtcp_init_rss − initialize RSS-based NIC-queue-to-TCP-port numbers mapping pool
int mtcp_init_rss(mctx_t mctx, in_addr_t srcip, int num_addr, in_addr_t dstip, in_addr_t dport);
mtcp_init_rss() creates a pool of TCP source ports that can be used by a client to generate outgoing connections for an arbitrary tuple of < srcip, dstip, and, dport > where ( srcip = source IPv4 address, dstip = destination IPv4 address, and dport = destination port number respectively). Choosing the appropriate set of source ports for each mTCP context, mctx (running on each CPU) is important for connecting to peer TCP endpoints: mTCP relies on the underlying symmetric RSS-based hash algorithm (based on Toeplitz function) to read traffic from NIC hardware queues. This function ensures that all packets, irrespective of the flow direction, are processed in the same CPU core.
Please note that mtcp_init_rss() assumes that the CPU core-id (as set inside mctx structure) will be used as the value for NIC queue-id, which the mTCP context will eventually access during its operation. For example, mTCP context running on core 3 will read traffic from NIC hardware queue-id 3.
num_addr is a reserved argument whose value should be set to 1 for the time being.
Returns 0 on success; -1 on failure. In case of failure, errno is set appropriately.
The default RSS algorithm set in NIC device is normally asymmetric. During NIC driver initialization, the mTCP core ensures that the seed for the RSS algorithm is re-set to make traffic reception symmetric. Also, during the driver intialization stage, the mTCP core assigns NIC queue(s) binding with arbitrary CPU core(s).
Failure to create mapping pool due to insufficient memory.
See http://an.kaist.ac.kr/~shinae/paper/2012-srss.pdf for details on symmetric Receive-Side Scaling (RSS).
mOS development team <firstname.lastname@example.org>
This page is part of mOS release 0.3 docs section. A description of the project, and information about reporting bugs, can be found at http://mos.kaist.edu/.