source: rtems/doc/networking/testing.t @ 52053579

4.104.114.95
Last change on this file since 52053579 was 52053579, checked in by Chris Johns <chrisj@…>, on 03/29/08 at 04:39:56

2008-03-29 Chris Johns <chrisj@…>

  • networking/testing.t: Patch from Ian Caddy to document the routes debug information.
  • Property mode set to 100644
File size: 11.2 KB
Line 
1@c
2@c  Written by Eric Norum
3@c
4@c  COPYRIGHT (c) 1988-2002.
5@c  On-Line Applications Research Corporation (OAR).
6@c  All rights reserved.
7@c
8@c  $Id$
9@c
10
11
12@chapter Testing the Driver
13
14@section Preliminary Setup
15
16The network used to test the driver should include at least:
17
18@itemize @bullet
19
20@item The hardware on which the driver is to run.
21It makes testing much easier if you can run a debugger to control
22the operation of the target machine.
23
24@item An Ethernet network analyzer or a workstation with an
25`Ethernet snoop' program such as @code{ethersnoop} or
26@code{tcpdump}.
27
28@item A workstation.
29
30@end itemize
31
32During early debug, you should consider putting the target, workstation,
33and snooper on a small network by themselves.  This offers a few
34advantages:
35
36@itemize @bullet
37
38@item There is less traffic to look at on the snooper and for the target
39to process while bringing the driver up.
40
41@item Any serious errors will impact only your small network not a building
42or campus network.  You want to avoid causing any unnecessary problems.
43
44@item Test traffic is easier to repeatably generate.
45
46@item Performance measurements are not impacted by other systems on
47the network.
48
49@end itemize
50
51@section Debug Output
52
53There are a number of sources of debug output that can be enabled
54to aid in tracing the behavior of the network stack.  The following
55is a list of them:
56
57@itemize @bullet
58
59@item mbuf activity
60
61There are commented out calls to @code{printf} in the file
62@code{sys/mbuf.h} in the network stack code.  Uncommenting
63these lines results in output when mbuf's are allocated
64and freed.  This is very useful for finding memory leaks.
65
66@item TX and RX queuing
67
68There are commented out calls to @code{printf} in the file
69@code{net/if.h} in the network stack code.  Uncommenting
70these lines results in output when packets are placed
71on or removed from one of the transmit or receive packet
72queues.  These queues can be viewed as the boundary line
73between a device driver and the network stack.  If the
74network stack is enqueuing packets to be transmitted that
75the device driver is not dequeuing, then that is indicative
76of a problem in the transmit side of the device driver.
77Conversely, if the device driver is enqueueing packets
78as it receives them (via a call to @code{ether_input}) and
79they are not being dequeued by the network stack,
80then there is a problem.  This situation would likely indicate
81that the network server task is not running.
82
83@item TCP state transitions
84
85In the unlikely event that one would actually want to see
86TCP state transitions, the @code{TCPDEBUG} macro can be defined
87in the file @code{opt_tcpdebug.h}.  This results in the routine
88@code{tcp_trace()} being called by the network stack and
89the state transitions logged into the @code{tcp_debug} data
90structure.  If the variable @code{tcpconsdebug} in the file
91@code{netinet/tcp_debug.c} is set to 1, then the state transitions
92will also be printed to the console.
93
94@end itemize
95
96@section Monitor Commands
97
98There are a number of command available in the shell / monitor
99to aid in tracing the behavior of the network stack.  The following
100is a list of them:
101
102@itemize @bullet
103
104@item @code{inet}
105
106This command shows the current routing information for the TCP/IP stack. Following is an
107example showing the output of this command.
108
109@code{Destination     Gateway/Mask/Hw    Flags     Refs     Use Expire Interface
11010.0.0.0        255.0.0.0          U           0        0     17 smc1
111127.0.0.1       127.0.0.1          UH          0        0      0 lo0}
112
113In this example, there is only one network interface with an IP address of 10.8.1.1.  This
114link is currently not up.
115
116Two routes that are shown are the default routes for the Ethernet interface (10.0.0.0) and the
117loopback interface (127.0.0.1).
118
119Since the stack comes from BSD, this command is very similar to the netstat command.  For more
120details on the network routing please look the following
121URL: (@code{http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/network-routing.html})
122
123For a quick reference to the flags, see the table below:
124
125U       Up: The route is active.
126H       Host: The route destination is a single host.
127G       Gateway: Send anything for this destination on to this remote
128        system, which will figure out from there where to send it.
129S       Static: This route was configured manually, not automatically
130        generated by the system.
131C       Clone: Generates a new route based upon this route for machines
132        we connect to. This type of route is normally used for local
133        networks.
134W       WasCloned: Indicated a route that was auto-configured based upon
135        a local area network (Clone) route.
136L       Link: Route involves references to Ethernet hardware.
137
138@item @code{mbuf}
139
140This command shows the current MBUF statistics.  An example of the command is shown below:
141
142@code{************ MBUF STATISTICS ************
143mbufs:4096    clusters: 256    free: 241
144drops:   0       waits:   0  drains:   0
145      free:4080          data:16          header:0           socket:0
146       pcb:0           rtable:0           htable:0           atable:0
147    soname:0           soopts:0           ftable:0           rights:0
148    ifaddr:0          control:0          oobdata:0
149}
150
151@item @code{if}
152
153This command shows the current statistics for your Ethernet driver as long as the ioctl hook
154@code{SIO_RTEMS_SHOW_STATS} has been implemented.  Below is an example:
155
156@code{************ INTERFACE STATISTICS ************
157***** smc1 *****
158Ethernet Address: 00:12:76:43:34:25
159Address:10.8.1.1        Broadcast Address:10.255.255.255  Net mask:255.0.0.0
160Flags: Up Broadcast Running Simplex
161Send queue limit:50   length:0    Dropped:0
162SMC91C111 RTEMS driver A0.01 11/03/2002 Ian Caddy (ianc@microsol.iinet.net.au)
163   Rx Interrupts:0              Not First:0               Not Last:0
164           Giant:0                   Runt:0              Non-octet:0
165         Bad CRC:0                Overrun:0              Collision:0
166   Tx Interrupts:2               Deferred:0        Missed Hearbeat:0
167      No Carrier:0       Retransmit Limit:0         Late Collision:0
168        Underrun:0        Raw output wait:0              Coalesced:0
169 Coalesce failed:0                Retries:0
170***** lo0 *****
171Address:127.0.0.1       Net mask:255.0.0.0
172Flags: Up Loopback Running Multicast
173Send queue limit:50   length:0    Dropped:0
174}
175
176@item @code{ip}
177
178This command show the IP statistics for the currently configured interfaces.
179
180@item @code{icmp}
181
182This command show the ICMP statistics for the currently configured interfaces.
183
184@item @code{tcp}
185
186This command show the TCP statistics for the currently configured interfaces.
187
188@item @code{udp}
189
190This command show the UDP statistics for the currently configured interfaces.
191
192@end itemize
193
194
195@section Driver basic operation
196
197The network demonstration program @code{netdemo} may be used for these tests.
198
199@itemize @bullet
200
201@item Edit @code{networkconfig.h} to reflect the values for your network.
202
203@item Start with @code{RTEMS_USE_BOOTP} not defined.
204
205@item Edit @code{networkconfig.h} to configure the driver
206with an
207explicit Ethernet and Internet address and with reception of
208broadcast packets disabled:
209
210Verify that the program continues to run once the driver has been attached.
211
212@item Issue a @samp{u} command to send UDP
213packets to the `discard' port.
214Verify that the packets appear on the network.
215
216@item Issue a @samp{s} command to print the network and driver statistics.
217
218@item On a workstation, add a static route to the target system.
219
220@item On that same workstation try to `ping' the target system.
221Verify that the ICMP echo request and reply packets appear on the net.
222
223@item Remove the static route to the target system.
224Modify @code{networkconfig.h} to attach the driver
225with reception of broadcast packets enabled.
226Try to `ping' the target system again.
227Verify that ARP request/reply and ICMP echo request/reply packets appear
228on the net.
229
230@item Issue a @samp{t} command to send TCP
231packets to the `discard' port.
232Verify that the packets appear on the network.
233
234@item Issue a @samp{s} command to print the network and driver statistics.
235
236@item Verify that you can telnet to ports 24742
237and 24743 on the target system from one or more
238workstations on your network.
239
240@end itemize
241
242@section BOOTP/DHCP operation
243
244Set up a BOOTP/DHCP server on the network.
245Set define @code{RTEMS USE_BOOT} in @code{networkconfig.h}.
246Run the @code{netdemo} test program.
247Verify that the target system configures itself from the BOOTP/DHCP server and
248that all the above tests succeed.
249
250@section Stress Tests
251
252Once the driver passes the tests described in the previous section it should
253be subjected to conditions which exercise it more
254thoroughly and which test its error handling routines.
255
256@subsection Giant packets
257
258@itemize @bullet
259@item Recompile the driver with @code{MAXIMUM_FRAME_SIZE} set to
260a smaller value, say 514.
261
262@item `Ping' the driver from another workstation and verify
263that frames larger than 514 bytes are correctly rejected.
264
265@item Recompile the driver with @code{MAXIMUM_FRAME_SIZE} restored  to 1518.
266@end itemize
267
268@subsection Resource Exhaustion
269
270@itemize @bullet
271@item Edit  @code{networkconfig.h}
272so that the driver is configured with just two receive and transmit descriptors.
273
274@item Compile and run the @code{netdemo} program.
275
276@item Verify that the program operates properly and that you can
277still telnet to both the ports.
278
279@item Display the driver statistics (Console `@code{s}' command or telnet
280`control-G' character) and verify that:
281
282@enumerate
283
284@item The number of transmit interrupts is non-zero.
285This indicates that all transmit descriptors have been in use at some time.
286
287@item The number of missed packets is non-zero.
288This indicates that all receive descriptors have been in use at some time.
289
290@end enumerate
291
292@end itemize
293
294@subsection Cable Faults
295
296@itemize @bullet
297@item Run the @code{netdemo} program.
298
299@item Issue a `@code{u}' console command to make the target machine transmit
300a bunch of UDP packets.
301
302@item While the packets are being transmitted, disconnect and reconnect the
303network cable.
304
305@item Display the network statistics and verify that the driver has
306detected the loss of carrier.
307
308@item Verify that you can still telnet to both ports on the target machine.
309
310@end itemize
311
312@subsection Throughput
313
314Run the @code{ttcp} network benchmark program.
315Transfer large amounts of data (100's of megabytes) to and from the target
316system.
317
318The procedure for testing throughput from a host to an RTEMS target
319is as follows:
320
321@enumerate
322@item Download and start the ttcp program on the Target.
323
324@item In response to the @code{ttcp} prompt, enter @code{-s -r}.  The
325meaning of these flags is described in the @code{ttcp.1} manual page
326found in the @code{ttcp_orig} subdirectory.
327
328@item On the host run @code{ttcp -s -t <<insert the hostname or IP address of
329the Target here>>}
330
331@end enumerate
332
333
334The procedure for testing throughput from an RTEMS target
335to a Host is as follows:
336
337@enumerate
338@item On the host run @code{ttcp -s -r}.
339
340@item Download and start the ttcp program on the Target.
341
342@item In response to the @code{ttcp} prompt, enter @code{-s -t <<insert
343the hostname or IP address of the Target here>>}.  You need to type the
344IP address of the host unless your Target is talking to your Domain Name
345Server.
346
347@end enumerate
348
349To change the number of buffers, the buffer size, etc. you just add the
350extra flags to the @code{-t} machine as specified in the @code{ttcp.1}
351manual page found in the @code{ttcp_orig} subdirectory.
352
353
354
355
356
Note: See TracBrowser for help on using the repository browser.