1 | @c |
---|
2 | @c Written by Eric Norum |
---|
3 | @c |
---|
4 | @c COPYRIGHT (c) 1988-1998. |
---|
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 | |
---|
16 | The 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. |
---|
21 | It makes testing much easier if you can run a debugger to control |
---|
22 | the 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 | |
---|
32 | During early debug, you should consider putting the target, workstation, |
---|
33 | and snooper on a small network by themselves. This offers a few |
---|
34 | advantages: |
---|
35 | |
---|
36 | @itemize @bullet |
---|
37 | |
---|
38 | @item There is less traffic to look at on the snooper and for the target |
---|
39 | to process while bringing the driver up. |
---|
40 | |
---|
41 | @item Any serious errors will impact only your small network not a building |
---|
42 | or 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 |
---|
47 | the network. |
---|
48 | |
---|
49 | @end itemize |
---|
50 | |
---|
51 | @section Debug Output |
---|
52 | |
---|
53 | There are a number of sources of debug output that can be enabled |
---|
54 | to aid in tracing the behavior of the network stack. The following |
---|
55 | is a list of them: |
---|
56 | |
---|
57 | @itemize @bullet |
---|
58 | |
---|
59 | @item mbuf activity |
---|
60 | |
---|
61 | There are commented out calls to @code{printf} in the file |
---|
62 | @code{sys/mbuf.h} in the network stack code. Uncommenting |
---|
63 | these lines results in output when mbuf's are allocated |
---|
64 | and freed. This is very useful for findind memory leaks. |
---|
65 | |
---|
66 | @item TX and RX queuing |
---|
67 | |
---|
68 | There are commented out calls to @code{printf} in the file |
---|
69 | @code{net/if.h} in the network stack code. Uncommenting |
---|
70 | these lines results in output when packets are placed |
---|
71 | on or removed from one of the transmit or receive packet |
---|
72 | queues. These queues can be viewed as the boundary line |
---|
73 | between a device driver and the network stack. If the |
---|
74 | network stack is enqueuing packets to be transmitted that |
---|
75 | the device driver is not dequeuing, then that is indicative |
---|
76 | of a problem in the transmit side of the device driver. |
---|
77 | Conversely, if the device driver is enqueueing packets |
---|
78 | as it receives them (via a call to @code{ether_input}) and |
---|
79 | they are not being dequeued by the network stack, |
---|
80 | then there is a problem. This situation would likely indicate |
---|
81 | that the network server task is not running. |
---|
82 | |
---|
83 | @item TCP state transitions |
---|
84 | |
---|
85 | In the unlikely event that one would actually want to see |
---|
86 | TCP state transitions, the @code{TCPDEBUG} macro can be defined |
---|
87 | in the file @code{opt_tcpdebug.h}. This results in the routine |
---|
88 | @code{tcp_trace()} being called by the network stack and |
---|
89 | the state transitions logged into the @code{tcp_debug} data |
---|
90 | structure. If the variable @code{tcpconsdebug} in the file |
---|
91 | @code{netinet/tcp_debug.c} is set to 1, then the state transitions |
---|
92 | will also be printed to the console. |
---|
93 | |
---|
94 | @end itemize |
---|
95 | |
---|
96 | @section Driver basic operation |
---|
97 | |
---|
98 | The network demonstration program @code{netdemo} may be used for these tests. |
---|
99 | |
---|
100 | @itemize @bullet |
---|
101 | |
---|
102 | @item Edit @code{networkconfig.h} to reflect the values for your network. |
---|
103 | |
---|
104 | @item Start with @code{RTEMS_USE_BOOTP} not defined. |
---|
105 | |
---|
106 | @item Edit @code{networkconfig.h} to configure the driver |
---|
107 | with an |
---|
108 | explicit Ethernet and Internet address and with reception of |
---|
109 | broadcast packets disabled: |
---|
110 | |
---|
111 | Verify that the program continues to run once the driver has been attached. |
---|
112 | |
---|
113 | @item Issue a @samp{u} command to send UDP |
---|
114 | packets to the `discard' port. |
---|
115 | Verify that the packets appear on the network. |
---|
116 | |
---|
117 | @item Issue a @samp{s} command to print the network and driver statistics. |
---|
118 | |
---|
119 | @item On a workstation, add a static route to the target system. |
---|
120 | |
---|
121 | @item On that same workstation try to `ping' the target system. |
---|
122 | Verify that the ICMP echo request and reply packets appear on the net. |
---|
123 | |
---|
124 | @item Remove the static route to the target system. |
---|
125 | Modify @code{networkconfig.h} to attach the driver |
---|
126 | with reception of broadcast packets enabled. |
---|
127 | Try to `ping' the target system again. |
---|
128 | Verify that ARP request/reply and ICMP echo request/reply packets appear |
---|
129 | on the net. |
---|
130 | |
---|
131 | @item Issue a @samp{t} command to send TCP |
---|
132 | packets to the `discard' port. |
---|
133 | Verify that the packets appear on the network. |
---|
134 | |
---|
135 | @item Issue a @samp{s} command to print the network and driver statistics. |
---|
136 | |
---|
137 | @item Verify that you can telnet to ports 24742 |
---|
138 | and 24743 on the target system from one or more |
---|
139 | workstations on your network. |
---|
140 | |
---|
141 | @end itemize |
---|
142 | |
---|
143 | @section BOOTP/DHCP operation |
---|
144 | |
---|
145 | Set up a BOOTP/DHCP server on the network. |
---|
146 | Set define @code{RTEMS USE_BOOT} in @code{networkconfig.h}. |
---|
147 | Run the @code{netdemo} test program. |
---|
148 | Verify that the target system configures itself from the BOOTP/DHCP server and |
---|
149 | that all the above tests succeed. |
---|
150 | |
---|
151 | @section Stress Tests |
---|
152 | |
---|
153 | Once the driver passes the tests described in the previous section it should |
---|
154 | be subjected to conditions which exercise it more |
---|
155 | thoroughly and which test its error handling routines. |
---|
156 | |
---|
157 | @subsection Giant packets |
---|
158 | |
---|
159 | @itemize @bullet |
---|
160 | @item Recompile the driver with @code{MAXIMUM_FRAME_SIZE} set to |
---|
161 | a smaller value, say 514. |
---|
162 | |
---|
163 | @item `Ping' the driver from another workstation and verify |
---|
164 | that frames larger than 514 bytes are correctly rejected. |
---|
165 | |
---|
166 | @item Recompile the driver with @code{MAXIMUM_FRAME_SIZE} restored to 1518. |
---|
167 | @end itemize |
---|
168 | |
---|
169 | @subsection Resource Exhaustion |
---|
170 | |
---|
171 | @itemize @bullet |
---|
172 | @item Edit @code{networkconfig.h} |
---|
173 | so that the driver is configured with just two receive and transmit descriptors. |
---|
174 | |
---|
175 | @item Compile and run the @code{netdemo} program. |
---|
176 | |
---|
177 | @item Verify that the program operates properly and that you can |
---|
178 | still telnet to both the ports. |
---|
179 | |
---|
180 | @item Display the driver statistics (Console `@code{s}' command or telnet |
---|
181 | `control-G' character) and verify that: |
---|
182 | |
---|
183 | @enumerate |
---|
184 | |
---|
185 | @item The number of transmit interrupts is non-zero. |
---|
186 | This indicates that all transmit descriptors have been in use at some time. |
---|
187 | |
---|
188 | @item The number of missed packets is non-zero. |
---|
189 | This indicates that all receive descriptors have been in use at some time. |
---|
190 | |
---|
191 | @end enumerate |
---|
192 | |
---|
193 | @end itemize |
---|
194 | |
---|
195 | @subsection Cable Faults |
---|
196 | |
---|
197 | @itemize @bullet |
---|
198 | @item Run the @code{netdemo} program. |
---|
199 | |
---|
200 | @item Issue a `@code{u}' console command to make the target machine transmit |
---|
201 | a bunch of UDP packets. |
---|
202 | |
---|
203 | @item While the packets are being transmitted, disconnect and reconnect the |
---|
204 | network cable. |
---|
205 | |
---|
206 | @item Display the network statistics and verify that the driver has |
---|
207 | detected the loss of carrier. |
---|
208 | |
---|
209 | @item Verify that you can still telnet to both ports on the target machine. |
---|
210 | |
---|
211 | @end itemize |
---|
212 | |
---|
213 | @subsection Throughput |
---|
214 | |
---|
215 | Run the @code{ttcp} network benchmark program. |
---|
216 | Transfer large amounts of data (100's of megabytes) to and from the target |
---|
217 | system. |
---|
218 | |
---|
219 | |
---|
220 | |
---|