⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 c-tcpip6.html

📁 vxworks相关论文
💻 HTML
📖 第 1 页 / 共 3 页
字号:
</td><td width="10">&nbsp;</td><td colspan=1 rowspan=1><div class="CellBody"><a name="93191"> </a>Default value: 40 </div><div class="CellBody"><a name="93192"> </a>Specifies the number of 512-byte clusters to initialize.</div></td><td width="10">&nbsp;</td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="93194"> </a>Number of 1024 byte clusters for user data</div><div class="CellBody"><a name="94632"> </a>(<b class="symbol_UC">NUM_1024</b>)</div></td><td width="10">&nbsp;</td><td colspan=1 rowspan=1><div class="CellBody"><a name="93196"> </a>Default value: 25 </div><div class="CellBody"><a name="93197"> </a>Specifies the number of 1024-byte clusters to initialize.</div></td><td width="10">&nbsp;</td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="93199"> </a>Number of 2048 byte clusters for user data</div><div class="CellBody"><a name="94633"> </a>(<b class="symbol_UC">NUM_2048</b>)</div></td><td width="10">&nbsp;</td><td colspan=1 rowspan=1><div class="CellBody"><a name="93201"> </a>Default value: 25 </div><div class="CellBody"><a name="93202"> </a>Specifies the number of 2048-byte clusters to initialize.</div></td><td width="10">&nbsp;</td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="93204"> </a>Size of network memory pool for user data</div><div class="CellBody"><a name="94634"> </a>(<b class="symbol_UC">NUM_CL_BLKS</b>)</div></td><td width="10">&nbsp;</td><td colspan=1 rowspan=1><div class="CellBody"><a name="93206"> </a>Default value: <b class="symbol_UC">NUM_64 + NUM_128 + NUM_256 + NUM_512 + NUM_1024 + NUM_2048</b> </div><div class="CellBody"><a name="93207"> </a>This value specifies the number of <b class="symbol_lc">clBlk</b> structures to initialize. You need exactly one <b class="symbol_lc">clBlk</b> structure per cluster. If you add another cluster pool to <b class="symbol_lc">clDescTbl[&nbsp;] </b>(described below), be sure you increment this value appropriately. </div></td><td width="10">&nbsp;</td></tr><tr><td colspan="20"><hr class="tablerule"></td></tr><tr valign="middle"><td colspan="20"></td></tr></table></p></p></dl></dl><dl class="margin"><dd><font face="Helvetica, sans-serif" size="-1" class="sans"><h5 class="HU"><i><a name="87028">Default Memory Pool Configuration for the Network Stack </a></i></h5></font><dl class="margin"><dd><p class="Body"><a name="87029"> </a>By default, the VxWorks network stack creates six pools (all within the main network memory pool) for clusters ranging in size from 64 bytes to 2048 bytes. However, valid cluster sizes can range from 64 bytes increasing by powers of two to 64K (65535). If your network stack needs clusters of a valid but non-default size, you can edit the <b class="symbol_lc">clDescTbl</b> table defined in <b class="file">target/src/config/usrNetwork.c</b>. The following is an example and <b class="symbol_lc">clDescTbl[&nbsp;]</b> table: </p><dl class="margin"><dd><pre class="Code2"><b><a name="87030">CL_DESC clDescTbl [] =  /* network cluster pool configuration table */             {             /*             clusterSize         num             memArea         memSize             -----------         ----            -------         -------             */             {64,                NUM_64,         NULL,           0},             {128,               NUM_128,        NULL,           0},             {256,               NUM_256,        NULL,           0},             {512,               NUM_512,        NULL,           0},             {1024,              NUM_1024,       NULL,           0},             {2048,              NUM_2048,       NULL,           0}             };</a></b></pre></dl><dd><p class="Body"><a name="87046"> </a>To add a cluster pool for clusters of 4096 bytes each, edit <b class="symbol_lc">clDescTbl[&nbsp;] </b>as follows: <sup><a href="#foot"><b class="FootnoteMarker">1</b></a></sup></p><dl class="margin"><dd><pre class="Code2"><b><a name="93893">CL_DESC clDescTbl [] =  /* network cluster pool configuration table */             {             /*             clusterSize         num             memArea         memSize             -----------         ----            -------         -------             */             {64,                NUM_64,         NULL,           0},             {128,               NUM_128,        NULL,           0},             {256,               NUM_256,        NULL,           0},             {512,               NUM_512,        NULL,           0},             {1024,              NUM_1024,       NULL,           0},             {2048,              NUM_2048,       NULL,           0},             {4096,              NUM_4096,       NULL,           0}             };</a></b></pre></dl></dl></dl><dl class="margin"><dd><p class="table" callout><table border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td valign="top" width="40"><br><img border="0" alt="*" src="icons/caution.gif"></td><td><hr><div class="CalloutCell"><a name="93898"><b class="symbol_UC"><font face="Helvetica, sans-serif" size="-1" class="sans">CAUTION:  </font></b></a>Adjust the counts for <b class="symbol_lc">mBlk</b>s, <b class="symbol_lc">clBlk</b>s, clusters, and cluster pools only after collecting data on system behavior and deciding whether or how you would like to change that behavior. Carefully planned changes can significantly improve performance, but reckless changes can significantly reduce performance.</div></td></tr><tr valign="top"><td></td><td><hr></td></tr><tr valign="middle"><td colspan="20"></td></tr></table></p callout><dl class="margin"><dd><p class="Body"><a name="93904"> </a>The values shown above are reasonable defaults, but the network requirements for your system could be radically different. For example, your use of the network stack could require more clusters of a particular size. Making such a determination is a matter of experimentation and analysis. However, as background information, you need to understand how data divides up into <b class="symbol_lc">mBlk</b>s, <b class="symbol_lc">clBlk</b>s, and clusters. </p><dd><p class="Body"><a name="87071"> </a>The <b class="symbol_lc">mBlk</b> structure is the primary vehicle through which you access data in a memory pool established by <b class="routine"><i class="routine">netPoolInit</i></b><b>(&nbsp;)</b>. Because the <b class="symbol_lc">mBlk</b> structure merely references the data, this lets network layers communicate data without actually having to copy the data. In addition, data can be chained using <b class="symbol_lc">mBlk</b>s. Thus, you can pass an arbitrarily large amount of data by passing the <b class="symbol_lc">mBlk</b> at the head of an <b class="symbol_lc">mBlk</b> chain. Consider <a href="c-tcpip6.html#87078">Figure&nbsp;4-5</a><div class="frame"><h4 class="EntityTitle"><a name="87078"><font face="Helvetica, sans-serif" size="-1" class="sans">Figure 4-5:&nbsp;&nbsp;Presentation of Two Packets to the TCP Layer</font></a></h4><dl class="margin"><div class="Anchor"><a name="87150"> </a><img class="figure" border="0" src="images/c-tcpip9.gif"></div></dl></div>. <sup><a href="#foot"><b class="FootnoteMarker">2</b></a></sup></p><dd><p class="Body"><a name="87157"> </a>As shown in <a href="c-tcpip6.html#87078">Figure&nbsp;4-5</a>, an <b class="symbol_lc">mBlk</b> references data only indirectly - through a <b class="symbol_lc">clBlk</b> structure. This indirection makes it easier for multiple <b class="symbol_lc">mBlk</b>s to share the same cluster. See <a href="c-tcpip6.html#87164">Figure&nbsp;4-6</a><div class="frame"><h4 class="EntityTitle"><a name="87164"><font face="Helvetica, sans-serif" size="-1" class="sans">Figure 4-6:&nbsp;&nbsp;Two <b class="symbol_lc">mBlk</b>s Can Share the Same Cluster </font></a></h4><dl class="margin"><div class="Anchor"><a name="87203"> </a><img class="figure" border="0" src="images/c-tcpip10.gif"></div></dl></div>. </p><dd><p class="Body"><a name="87204"> </a>Please note that using a <b class="symbol_lc">clBlk</b> structure instead of a pointer to provide a level of indirection is not an extravagance. The <b class="symbol_lc">clBlk</b> structure tracks how many <b class="symbol_lc">mBlk</b>s share its underlying cluster. This is critical when it comes time to free an <b class="symbol_lc">mBlk</b>/<b class="symbol_lc">clBlk</b>/cluster construct. If you use <b class="routine"><i class="routine">netMblkClFree</i></b><b>(&nbsp;)</b> to free the construct, the <b class="symbol_lc">mBlk</b> is freed back to the pool and the reference count in the <b class="symbol_lc">clBlk</b> is decremented. If the reference count drops to zero, the <b class="symbol_lc">clBlk</b> and cluster are also freed back to the memory pool.</p></dl></dl><dl class="margin"><dd><font face="Helvetica, sans-serif" size="-1" class="sans"><h5 class="HU"><i><a name="87205">Configuring Memory Pools Out of Private Memory </a></i></h5></font><dl class="margin"><dd><p class="Body"><a name="87206"> </a>The <b class="symbol_lc">clDescTbl[&nbsp;]</b> shown in the previous section did not make use of the <b class="symbol_lc">memArea</b> and <b class="symbol_lc">memSize</b> members. For the default network buffer pool,  the memory allocation calls are handled internally and the values of <b class="symbol_lc">memArea</b> and <b class="symbol_lc">memSize</b> are set for you. However, if necessary, you can supply these values and thus explicitly determine the size and location of the memory pools. For more information on how to use the <b class="symbol_lc">memArea</b> and <b class="symbol_lc">memSize</b> members, see the reference entry for <b class="routine"><i class="routine">netPoolInit</i></b><b>(&nbsp;)</b>. </p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="87208">4.6.4  &nbsp;&nbsp;Testing Network Connections</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="87211"> </a>You can use the <b class="routine"><i class="routine">ping</i></b><b>(&nbsp;)</b> utility from VxWorks to test whether a particular system is accessible over the network.  Like the UNIX command of the same name, <b class="routine"><i class="routine">ping</i></b><b>(&nbsp;)</b>sends one or more packets to another system and waits for a response.  You can identify the other system either by name or by its numeric Internet address.  This is useful for testing routing tables and host tables, or determining whether another machine is responding to network requests.</p><dd><p class="Body"><a name="87212"> </a>The following example shows <b class="routine"><i class="routine">ping</i></b><b>(&nbsp;)</b> output for an unreachable address:</p><dl class="margin"><dd><pre class="Code2"><b><a name="87213"></b><tt class="output">-&gt; </tt><b>ping "150.12.0.1",1 </b><tt class="output">no answer from 150.12.0.1 value = -1 = 0xffffffff = _end + 0xfff91c4f</tt><b></a></b></pre></dl><dd><p class="Body"><a name="87214"> </a>If the first argument uses a host name, <b class="routine"><i class="routine">ping</i></b><b>(&nbsp;)</b> uses the host table to look it up, as in the following example:</p><dl class="margin"><dd><pre class="Code2"><b><a name="87215"></b><tt class="output">-&gt; </tt><b>ping "caspian",1 </b><tt class="output">caspian is alive value = 0 = 0x0</tt><b></a></b></pre></dl><dd><p class="Body"><a name="87216"> </a>The numeric argument specifies how many packets to expect back (typically, when an address is reachable, that is also how many packets are sent).  If you specify more than one packet, <b class="routine"><i class="routine">ping</i></b><b>(&nbsp;)</b> displays more elaborate output, including summary statistics.  For example, the following test sends packets to a remote network address until it receives ten acknowledgments, and reports on the time it takes to get replies:</p></dl><dl class="margin"><dd><pre class="Code"><b><a name="87217"></b><tt class="output">-&gt; </tt><b>ping "198.41.0.5",10 </b><tt class="output">PING 198.41.0.5: 56 data bytes 64 bytes from 198.41.0.5: icmp_seq=0. time=176. ms 64 bytes from 198.41.0.5: icmp_seq=1. time=64. ms 64 bytes from 198.41.0.5: icmp_seq=2. time=64. ms 64 bytes from 198.41.0.5: icmp_seq=3. time=64. ms 64 bytes from 198.41.0.5: icmp_seq=4. time=80. ms 64 bytes from 198.41.0.5: icmp_seq=5. time=64. ms 64 bytes from 198.41.0.5: icmp_seq=6. time=64. ms 64 bytes from 198.41.0.5: icmp_seq=7. time=64. ms 64 bytes from 198.41.0.5: icmp_seq=8. time=64. ms 64 bytes from 198.41.0.5: icmp_seq=9. time=64. ms  ----198.41.0.5 PING Statistics---- 10 packets transmitted, 10 packets received, 0% packet loss round-trip (ms)  min/avg/max = 64/76/176 value = 0 = 0x0</tt><b></a></b></pre></dl><dl class="margin"><dd><p class="Body"><a name="87218"> </a>The report format matches the format used by the UNIX <b class="command">ping</b> utility.  Timings are based on the system clock; its resolution could be too coarse to show any elapsed time when communicating with targets on a local network.</p><dd><p class="Body"><a name="87219"> </a>Applications can use <b class="routine"><i class="routine">ping</i></b><b>(&nbsp;)</b> periodically to test whether another network node is available.  To support this use, the <b class="routine"><i class="routine">ping</i></b><b>(&nbsp;)</b> routine returns a <b class="symbol_UC">STATUS</b> value and accepts a <b class="symbol_UC">PING_OPT_SILENT</b> flag as a bit in its third argument to suppress printed output, as in the following code fragment:</p><dl class="margin"><dd><pre class="Code2"><b><a name="87220">/* Check whether other system still there */  if (ping (partnerName, 1, PING_OPT_SILENT) == ERROR)     {     myShutdown();              /* clean up and exit */     } ...</a></b></pre></dl><dd><p class="Body"><a name="87222"> </a>You can set one other flag in the third <b class="routine"><i class="routine">ping</i></b><b>(&nbsp;)</b> argument: <b class="symbol_UC">PING_OPT_DONTROUTE</b> restricts <b class="routine"><i class="routine">ping</i></b><b>(&nbsp;)</b> to hosts that are directly connected, without going through a gateway.</p></dl></dl><a name="foot"><hr></a><p class="FootnoteNumberMarker">1:&nbsp;<span class="Footnote"><a name="87045"> </a>For this particular <b class="symbol_lc">clDescTbl[&nbsp;] </b>table only, you can specify <b class="symbol_lc">memArea</b> values as NULL and <b class="symbol_lc">memSize </b>values as 0. When the network initialization code actually allocates the necessary memory, it resets these values appropriately. For all other <b class="symbol_lc">clDescTbl[&nbsp;] </b>tables, you must provide these values explicitly before calling <b class="routine"><i class="routine">netPoolInit</i></b><b>(&nbsp;)</b>. For more information, see the reference entry for <b class="routine"><i class="routine">netPoolInit</i></b><b>(&nbsp;)</b>. </span><p class="FootnoteNumberMarker">2:&nbsp;<span class="Footnote"><a name="87153"> </a>To support chaining across multiple packets, the <b class="symbol_lc">mBlk</b> structure contains two members that  <br>support of chaining. One member points to the next <b class="symbol_lc">mBlk</b> in the current packet. The other member points to the head <b class="symbol_lc">mBlk</b> in the next packet (if any).</span><p class="navbar" align="right"><a href="index.html"><img border="0" alt="[Contents]" src="icons/contents.gif"></a><a href="c-tcpip.html"><img border="0" alt="[Index]" src="icons/index.gif"></a><a href="c-tcpip.html"><img border="0" alt="[Top]" src="icons/top.gif"></a><a href="c-tcpip5.html"><img border="0" alt="[Prev]" src="icons/prev.gif"></a><a href="c-tcpip7.html"><img border="0" alt="[Next]" src="icons/next.gif"></a></p></body></html><!---by WRS Documentation (), Wind River Systems, Inc.    conversion tool:  Quadralay WebWorks Publisher 4.0.11    template:         CSS Template, Jan 1998 - Jefro --->

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -