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