1<!-- Creator     : groff version 1.22.2 -->
2<!-- CreationDate: Wed Feb  1 23:55:12 2017 -->
3<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
4"http://www.w3.org/TR/html4/loose.dtd">
5<html>
6<head>
7<meta name="generator" content="groff -Thtml, see www.gnu.org">
8<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
9<meta name="Content-Style" content="text/css">
10<style type="text/css">
11       p       { margin-top: 0; margin-bottom: 0; vertical-align: top }
12       pre     { margin-top: 0; margin-bottom: 0; vertical-align: top }
13       table   { margin-top: 0; margin-bottom: 0; vertical-align: top }
14       h1      { text-align: center }
15</style>
16<title>mtcp_init_rss</title>
17
18</head>
19<body>
20
21<h1 align="center">mtcp_init_rss</h1>
22
23<a href="#NAME">NAME</a><br>
24<a href="#SYNOPSIS">SYNOPSIS</a><br>
25<a href="#DESCRIPTION">DESCRIPTION</a><br>
26<a href="#RETURN VALUE">RETURN VALUE</a><br>
27<a href="#NOTES">NOTES</a><br>
28<a href="#ERRORS">ERRORS</a><br>
29<a href="#NOTES">NOTES</a><br>
30<a href="#AUTHORS">AUTHORS</a><br>
31<a href="#SEE ALSO">SEE ALSO</a><br>
32<a href="#COLOPHON">COLOPHON</a><br>
33
34<hr>
35
36
37<h2>NAME
38<a name="NAME"></a>
39</h2>
40
41
42<p style="margin-left:11%; margin-top: 1em">mtcp_init_rss
43&minus; initialize RSS-based NIC-queue-to-TCP-port numbers
44mapping pool</p>
45
46<h2>SYNOPSIS
47<a name="SYNOPSIS"></a>
48</h2>
49
50
51<p style="margin-left:11%; margin-top: 1em"><b>#include
52&lt;mtcp_api.h&gt;</b></p>
53
54<p style="margin-left:11%; margin-top: 1em"><b>int
55mtcp_init_rss(mctx_t</b> <i>mctx</i><b>, in_addr_t</b>
56<i>srcip</i><b>, int</b> <i>num_addr</i><b>, in_addr_t</b>
57<i>dstip</i><b>, in_addr_t</b> <i>dport</i><b>);</b></p>
58
59<h2>DESCRIPTION
60<a name="DESCRIPTION"></a>
61</h2>
62
63
64
65<p style="margin-left:11%; margin-top: 1em"><b>mtcp_init_rss</b>()
66creates a pool of TCP source ports that can be used by a
67client to generate outgoing connections for an arbitrary
68tuple of &lt; <i>srcip, dstip,</i> and, <i>dport</i> &gt;
69where ( <i>srcip</i> = source IPv4 address, <i>dstip</i> =
70destination IPv4 address, and <i>dport</i> = destination
71port number respectively). Choosing the appropriate set of
72source ports for each mTCP context, <i>mctx</i> (running on
73each CPU) is important for connecting to peer TCP endpoints:
74mTCP relies on the underlying symmetric RSS-based hash
75algorithm (based on Toeplitz function) to read traffic from
76NIC hardware queues. This function ensures that all packets,
77irrespective of the flow direction, are processed in the
78same CPU core.</p>
79
80<p style="margin-left:11%; margin-top: 1em">Please note
81that <b>mtcp_init_rss()</b> assumes that the CPU core-id (as
82set inside <i>mctx</i> structure) will be used as the value
83for NIC queue-id, which the mTCP context will eventually
84access during its operation. For example, mTCP context
85running on core 3 will read traffic from NIC hardware
86queue-id 3.</p>
87
88
89<p style="margin-left:11%; margin-top: 1em"><i>num_addr</i>
90is a reserved argument whose value should be set to 1 for
91the time being.</p>
92
93<h2>RETURN VALUE
94<a name="RETURN VALUE"></a>
95</h2>
96
97
98<p style="margin-left:11%; margin-top: 1em">Returns 0 on
99success; -1 on failure. In case of failure, <i>errno</i> is
100set appropriately.</p>
101
102<h2>NOTES
103<a name="NOTES"></a>
104</h2>
105
106
107<p style="margin-left:11%; margin-top: 1em">The default RSS
108algorithm set in NIC device is normally asymmetric. During
109NIC driver initialization, the mTCP core ensures that the
110seed for the RSS algorithm is re-set to make traffic
111reception symmetric. Also, during the driver intialization
112stage, the mTCP core assigns NIC queue(s) binding with
113arbitrary CPU core(s).</p>
114
115<h2>ERRORS
116<a name="ERRORS"></a>
117</h2>
118
119
120<table width="100%" border="0" rules="none" frame="void"
121       cellspacing="0" cellpadding="0">
122<tr valign="top" align="left">
123<td width="11%"></td>
124<td width="9%">
125
126
127<p style="margin-top: 1em"><b>ENOMEM</b></p></td>
128<td width="6%"></td>
129<td width="74%">
130
131
132<p style="margin-top: 1em">Failure to create mapping pool
133due to insufficient memory.</p></td></tr>
134</table>
135
136<h2>NOTES
137<a name="NOTES"></a>
138</h2>
139
140
141<p style="margin-left:11%; margin-top: 1em">See
142<b>http://an.kaist.ac.kr/~shinae/paper/2012-srss.pdf</b> for
143details on symmetric Receive-Side Scaling (RSS).</p>
144
145<h2>AUTHORS
146<a name="AUTHORS"></a>
147</h2>
148
149
150<p style="margin-left:11%; margin-top: 1em">mOS development
151team &lt;[email protected]&gt;</p>
152
153<h2>SEE ALSO
154<a name="SEE ALSO"></a>
155</h2>
156
157
158
159<p style="margin-left:11%; margin-top: 1em"><b>mtcp_init</b>(),
160<b>mtcp_destroy</b>()</p>
161
162<h2>COLOPHON
163<a name="COLOPHON"></a>
164</h2>
165
166
167<p style="margin-left:11%; margin-top: 1em">This page is
168part of mOS release 0.3 <i>docs</i> section. A description
169of the project, and information about reporting bugs, can be
170found at http://mos.kaist.edu/.</p>
171<hr>
172</body>
173</html>
174