1 /* This NetX test concentrates on the basic packet operations. */
2
3 #include "tx_api.h"
4 #include "nx_api.h"
5 #include "nx_packet.h"
6
7 #define DEMO_STACK_SIZE 2048
8
9 #define TEST_SIZE (NX_UDP_PACKET+28)
10
11 #ifndef NX_PACKET_ALIGNMENT
12 #define NX_PACKET_ALIGNMENT sizeof(ULONG)
13 #endif /* NX_PACKET_ALIGNMENT */
14
15 /* Define the ThreadX and NetX object control blocks... */
16
17 static TX_THREAD ntest_0;
18
19 static NX_PACKET_POOL pool_0;
20 static NX_PACKET_POOL pool_1;
21 static NX_PACKET_POOL pool_2;
22 #ifdef NX_DISABLE_ERROR_CHECKING
23 static NX_PACKET_POOL pool_3;
24 #endif
25 static NX_PACKET_POOL pool_4;
26
27
28 /* Define the counters used in the test application... */
29
30 static ULONG error_counter;
31 static CHAR *pool_0_ptr;
32 static CHAR *pool_1_ptr;
33 static CHAR *pool_2_ptr;
34 #ifdef NX_DISABLE_ERROR_CHECKING
35 static CHAR *pool_3_ptr;
36 #endif
37 static CHAR *pool_4_ptr;
38 static ULONG pool_0_size;
39
40
41 static UCHAR buffer[2048];
42
43 /* Define thread prototypes. */
44
45 static void ntest_0_entry(ULONG thread_input);
46 extern void test_control_return(UINT status);
47
48 /* Define what the initial system looks like. */
49
50 #ifdef CTEST
test_application_define(void * first_unused_memory)51 VOID test_application_define(void *first_unused_memory)
52 #else
53 void netx_packet_basic_test_application_define(void *first_unused_memory)
54 #endif
55 {
56
57 CHAR *pointer;
58 UINT status;
59
60
61 /* Setup the working pointer. */
62 pointer = (CHAR *) first_unused_memory;
63
64 error_counter = 0;
65 pool_0_ptr = NX_NULL;
66 pool_1_ptr = NX_NULL;
67 pool_2_ptr = NX_NULL;
68
69 /* Create the main thread. */
70 tx_thread_create(&ntest_0, "thread 0", ntest_0_entry, 0,
71 pointer, DEMO_STACK_SIZE,
72 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START);
73 pointer = pointer + DEMO_STACK_SIZE;
74
75 /* Initialize the NetX system. */
76 nx_system_initialize();
77
78
79 /* Create first packet pool. */
80 pointer = (CHAR *)(((ALIGN_TYPE)pointer + NX_PACKET_ALIGNMENT - 1) & ~(NX_PACKET_ALIGNMENT - 1));
81 pool_0_ptr = pointer;
82 pool_0_size = (((TEST_SIZE + NX_PACKET_ALIGNMENT - 1) & ~(NX_PACKET_ALIGNMENT - 1)) + ((sizeof(NX_PACKET) + NX_PACKET_ALIGNMENT - 1) & ~(NX_PACKET_ALIGNMENT - 1))) * 3;
83 status = nx_packet_pool_create(&pool_0, "NetX Main Packet Pool", TEST_SIZE, pool_0_ptr, pool_0_size);
84
85 pointer = pointer + pool_0_size;
86 if (status)
87 error_counter++;
88
89 /* Create second packet pool. */
90 pointer = (CHAR *)(((ALIGN_TYPE)pointer + NX_PACKET_ALIGNMENT - 1) & ~(NX_PACKET_ALIGNMENT - 1));
91 status = nx_packet_pool_create(&pool_1, "NetX Second Packet Pool", 200, pointer, 1000);
92 pool_1_ptr = pointer;
93 pointer = pointer + 1000;
94
95 if (status)
96 error_counter++;
97
98 /* Create third packet pool. */
99 pointer = (CHAR *)(((ALIGN_TYPE)pointer + NX_PACKET_ALIGNMENT - 1) & ~(NX_PACKET_ALIGNMENT - 1));
100 status = nx_packet_pool_create(&pool_2, "NetX Third Packet Pool", 256, pointer, 8192);
101 pool_2_ptr = pointer;
102 pointer = pointer + 8192;
103
104 if (status)
105 error_counter++;
106
107 #ifdef NX_DISABLE_ERROR_CHECKING
108 /* Create fourth packet pool, small pool size. */
109 status = nx_packet_pool_create(&pool_3, "NetX Fourth Packet Pool", 256, pointer, 200);
110 pool_3_ptr = pointer;
111 pointer = pointer + 200;
112
113 if (status)
114 error_counter++;
115 #endif
116
117 /* Create fourth packet pool, small pool size. */
118 pointer = (CHAR *)(((ALIGN_TYPE)pointer + NX_PACKET_ALIGNMENT - 1) & ~(NX_PACKET_ALIGNMENT - 1));
119 status = nx_packet_pool_create(&pool_4, "NetX Fifth Packet Pool", 252, pointer, 8192);
120 pool_4_ptr = pointer;
121 pointer = pointer + 8192;
122
123 if (status)
124 error_counter++;
125 }
126
127
128
129 /* Define the test threads. */
130
ntest_0_entry(ULONG thread_input)131 static void ntest_0_entry(ULONG thread_input)
132 {
133
134 UINT status;
135 NX_PACKET *my_packet1;
136 NX_PACKET *my_packet2;
137 NX_PACKET *my_packet3;
138 NX_PACKET *my_packet4;
139 #if !defined(NX_DISABLE_PACKET_CHAIN) && defined(__PRODUCT_NETXDUO__)
140 NX_PACKET *packet_ptr;
141 #endif /* !defined(NX_DISABLE_PACKET_CHAIN) && defined(__PRODUCT_NETXDUO__) */
142 ULONG size;
143 UCHAR local_buffer[300];
144 ULONG total_packets, free_packets, empty_pool_requests, empty_pool_suspensions, invalid_packet_releases;
145
146 /* Print out test information banner. */
147 printf("NetX Test: Packet Basic Processing Test..............................");
148
149 /* Check for earlier error. */
150 if (error_counter)
151 {
152
153 printf("ERROR!\n");
154 test_control_return(1);
155 }
156
157 /* Delete all the packet pools. */
158 status = nx_packet_pool_delete(&pool_0);
159 status += nx_packet_pool_delete(&pool_1);
160 status += nx_packet_pool_delete(&pool_2);
161 #ifdef NX_DISABLE_ERROR_CHECKING
162 status += nx_packet_pool_delete(&pool_3);
163 #endif
164 status += nx_packet_pool_delete(&pool_4);
165
166 /* Check for error. */
167 if (status)
168 {
169
170 printf("ERROR!\n");
171 test_control_return(1);
172 }
173
174 /* Create the pools again. */
175 status = nx_packet_pool_create(&pool_0, "NetX Main Packet Pool", TEST_SIZE, pool_0_ptr, pool_0_size);
176 status += nx_packet_pool_create(&pool_1, "NetX Second Packet Pool", TEST_SIZE, pool_1_ptr, 1000);
177 status += nx_packet_pool_create(&pool_2, "NetX Third Packet Pool", 256, pool_2_ptr, 8192);
178 #ifdef NX_DISABLE_ERROR_CHECKING
179 status += nx_packet_pool_create(&pool_3, "NetX Fourth Packet Pool", 256, pool_3_ptr, 200);
180 #endif
181 status += nx_packet_pool_create(&pool_4, "NetX Fifth Packet Pool", 252, pool_4_ptr, 8192);
182
183 /* Check for error. */
184 if (status)
185 {
186
187 printf("ERROR!\n");
188 test_control_return(1);
189 }
190
191 /* Allocate packets. */
192 status = nx_packet_allocate(&pool_4, &my_packet1, NX_UDP_PACKET, 10);
193 status += nx_packet_allocate(&pool_4, &my_packet2, NX_UDP_PACKET, 10);
194
195 /* Check status. */
196 if (status != NX_SUCCESS)
197 {
198
199 printf("ERROR!\n");
200 test_control_return(1);
201 }
202
203 /* Check alignment. */
204 if(((ALIGN_TYPE)my_packet1 & (NX_PACKET_ALIGNMENT - 1)) ||
205 ((ALIGN_TYPE)my_packet2 & (NX_PACKET_ALIGNMENT - 1)) ||
206 ((ALIGN_TYPE)(my_packet1 -> nx_packet_data_start) & (NX_PACKET_ALIGNMENT - 1)) ||
207 ((ALIGN_TYPE)(my_packet2 -> nx_packet_data_start) & (NX_PACKET_ALIGNMENT - 1)))
208 {
209
210 printf("ERROR!\n");
211 test_control_return(1);
212 }
213
214 status = nx_packet_release(my_packet1);
215 status += nx_packet_release(my_packet2);
216
217 /* Check status. */
218 if (status != NX_SUCCESS)
219 {
220
221 printf("ERROR!\n");
222 test_control_return(1);
223 }
224
225
226 /* Allocate packets. */
227 status = nx_packet_allocate(&pool_0, &my_packet1, NX_UDP_PACKET, 10);
228 status += nx_packet_allocate(&pool_0, &my_packet2, NX_UDP_PACKET, 10);
229 status += nx_packet_allocate(&pool_0, &my_packet3, NX_UDP_PACKET, 10);
230
231 /* Check status. */
232 if (status != NX_SUCCESS)
233 {
234
235 printf("ERROR!\n");
236 test_control_return(1);
237 }
238
239 /* Attempt to allocate another packet to get the error return. */
240 status = nx_packet_allocate(&pool_0, &my_packet4, NX_UDP_PACKET, NX_NO_WAIT);
241
242 /* Check status. */
243 if (status != NX_NO_PACKET)
244 {
245
246 printf("ERROR!\n");
247 test_control_return(1);
248 }
249
250 /* Release all the packets but the first. */
251 status = nx_packet_release(my_packet2);
252 status += nx_packet_release(my_packet3);
253
254 /* Check status. */
255 if (status != NX_SUCCESS)
256 {
257
258 printf("ERROR!\n");
259 test_control_return(1);
260 }
261
262 /* Place the alphabet in the packet. */
263 status = nx_packet_data_append(my_packet1, "ABCDEFGHIJKLMNOPQRSTUVWXYZ ", 28, &pool_0, NX_NO_WAIT);
264
265 /* Check status. */
266 if (status != NX_SUCCESS)
267 {
268
269 printf("ERROR!\n");
270 test_control_return(1);
271 }
272
273 /* Copy the packet to another pool. */
274 status = nx_packet_copy(my_packet1, &my_packet2, &pool_1, NX_NO_WAIT);
275
276 /* Check status. */
277 if ((status != NX_SUCCESS) || (my_packet2 -> nx_packet_length != 28))
278 {
279
280 printf("ERROR!\n");
281 test_control_return(1);
282 }
283
284 /* Retrieve the payload from new packet. */
285 local_buffer[0] = 0;
286 status = nx_packet_data_retrieve(my_packet2, local_buffer, &size);
287
288 /* Check status. */
289 if ((status) || (my_packet2 -> nx_packet_length != 28) || (size != 28) || (local_buffer[0] != 'A'))
290 {
291
292 printf("ERROR!\n");
293 test_control_return(1);
294 }
295
296 /* Release the packet copy. */
297 status = nx_packet_release(my_packet2);
298
299 #if !defined(NX_DISABLE_PACKET_CHAIN) && defined(__PRODUCT_NETXDUO__)
300 /* Make sure the packet is chained. */
301 while(my_packet1 -> nx_packet_next == (NX_PACKET *)NX_NULL)
302 {
303
304 /* Append numbers to first message. This will introduce packet chaining. */
305 status += nx_packet_data_append(my_packet1, "0102030405060708091011121314151617181920", 40, &pool_0, NX_NO_WAIT);
306 }
307
308 /* Trim data in the last packet. */
309 my_packet1 -> nx_packet_length -= (ULONG)((ALIGN_TYPE)my_packet1 -> nx_packet_last -> nx_packet_append_ptr - (ALIGN_TYPE)my_packet1 -> nx_packet_last -> nx_packet_append_ptr);
310 my_packet1 -> nx_packet_last = my_packet1;
311 packet_ptr = my_packet1 -> nx_packet_next;
312
313 /* Append numbers to first message. This will reuse the packet chaining. */
314 status += nx_packet_data_append(my_packet1, "abc", 3, &pool_0, NX_NO_WAIT);
315
316 /* Check status. */
317 if ((status != NX_SUCCESS) || (my_packet1 -> nx_packet_next != packet_ptr))
318 {
319
320 printf("ERROR!\n");
321 test_control_return(1);
322 }
323
324 /* Copy the packet to a packet in both pools. This requires chaining and non-chaining. */
325 status = nx_packet_copy(my_packet1, &my_packet2, &pool_1, NX_NO_WAIT);
326 status += nx_packet_copy(my_packet2, &my_packet3, &pool_2, NX_NO_WAIT);
327
328 /* Check status. */
329 if ((status != NX_SUCCESS) ||
330 (my_packet2 -> nx_packet_length != my_packet1 -> nx_packet_length) ||
331 (my_packet3 -> nx_packet_length != my_packet2 -> nx_packet_length))
332 {
333
334 printf("ERROR!\n");
335 test_control_return(1);
336 }
337
338 /* Retrieve the payload from the first new packet. */
339 local_buffer[0] = 0;
340 status = nx_packet_data_retrieve(my_packet2, local_buffer, &size);
341
342 /* Check status. */
343 if ((status) ||
344 (my_packet1 -> nx_packet_length != my_packet2 -> nx_packet_length) ||
345 (size != my_packet2 -> nx_packet_length) ||
346 (local_buffer[0] != 'A') || (local_buffer[28] != '0'))
347 {
348
349 printf("ERROR!\n");
350 test_control_return(1);
351 }
352
353 /* Retrieve the payload from the second new packet. */
354 local_buffer[0] = 0;
355 status = nx_packet_data_retrieve(my_packet3, local_buffer, &size);
356
357 /* Check status. */
358 if ((status) || (my_packet3 -> nx_packet_length != my_packet2 -> nx_packet_length) ||
359 (size != my_packet2 -> nx_packet_length) ||
360 (local_buffer[0] != 'A') || (local_buffer[28] != '0'))
361 {
362
363 printf("ERROR!\n");
364 test_control_return(1);
365 }
366 #endif /* NX_DISABLE_PACKET_CHAIN && __PRODUCT_NETXDUO__ */
367
368 /* Transmit release all packets. */
369 status = nx_packet_transmit_release(my_packet1);
370
371 #if !defined(NX_DISABLE_PACKET_CHAIN) && defined(__PRODUCT_NETXDUO__)
372 status += nx_packet_transmit_release(my_packet2);
373 status += nx_packet_transmit_release(my_packet3);
374 #endif /* NX_DISABLE_PACKET_CHAIN && __PRODUCT_NETXDUO__ */
375
376 /* Get nothing from the first pool. */
377 status += nx_packet_pool_info_get(&pool_0, NX_NULL, NX_NULL, NX_NULL, NX_NULL, NX_NULL);
378
379 /* Get information about the first pool. */
380 status += nx_packet_pool_info_get(&pool_0, &total_packets, &free_packets, &empty_pool_requests, &empty_pool_suspensions, &invalid_packet_releases);
381
382 #ifndef NX_DISABLE_PACKET_INFO
383
384 if(empty_pool_requests != 1)
385 status++;
386 #endif
387
388 /* Check status. */
389 if ((status) || (total_packets != 3) || (free_packets != 3) || (empty_pool_suspensions) || (invalid_packet_releases))
390 {
391
392 printf("ERROR!\n");
393 test_control_return(1);
394 }
395
396 /* Delete all the packet pools. */
397 status = nx_packet_pool_delete(&pool_0);
398 status += nx_packet_pool_delete(&pool_1);
399 status += nx_packet_pool_delete(&pool_2);
400 #ifdef NX_DISABLE_ERROR_CHECKING
401 status += nx_packet_pool_delete(&pool_3);
402 #endif
403
404 /* Check for error. */
405 if (status)
406 {
407
408 printf("ERROR!\n");
409 test_control_return(1);
410 }
411
412 /* Tested the abnormal operation. */
413
414 /* Create the pools again. */
415 status = nx_packet_pool_create(&pool_0, "NetX Main Packet Pool", TEST_SIZE, pool_0_ptr, pool_0_size);
416 status += nx_packet_pool_create(&pool_1, "NetX Main Packet Pool", TEST_SIZE, pool_1_ptr, 1000);
417
418 /* Check for error. */
419 if (status)
420 {
421
422 printf("ERROR!\n");
423 test_control_return(1);
424 }
425
426 /* Allocate the packet. */
427 status = nx_packet_allocate(&pool_0, &my_packet1, 0, NX_NO_WAIT);
428
429 /* Check for error. */
430 if (status)
431 {
432
433 printf("ERROR!\n");
434 test_control_return(1);
435 }
436
437 #ifdef __PRODUCT_NETXDUO__
438 /* Append data that is larger than whole pool. */
439 status = nx_packet_data_append(my_packet1, buffer, sizeof(buffer), &pool_0, NX_NO_WAIT);
440
441 /* Check the status. */
442 if((!status) ||(pool_0.nx_packet_pool_invalid_releases))
443 {
444
445 printf("ERROR!\n");
446 test_control_return(1);
447 }
448 #endif /* __PRODUCT_NETXDUO__ */
449
450 /* Copy the packet with length 0. */
451 status = nx_packet_copy(my_packet1, &my_packet2, &pool_0, NX_NO_WAIT);
452
453 /* Check the status. */
454 if(!status)
455 {
456
457 printf("ERROR!\n");
458 test_control_return(1);
459 }
460
461 #if !defined(NX_DISABLE_PACKET_CHAIN) && defined(__PRODUCT_NETXDUO__)
462 /* Append data that is two packet size. */
463 status = nx_packet_data_append(my_packet1, buffer, TEST_SIZE * 2, &pool_0, NX_NO_WAIT);
464
465 /* Check the status. */
466 if(status)
467 {
468
469 printf("ERROR!\n");
470 test_control_return(1);
471 }
472
473 /* Copy the packet when the pool size not enough. */
474 status = nx_packet_copy(my_packet1, &my_packet2, &pool_0, NX_NO_WAIT);
475
476 /* Check the status. */
477 if(!status)
478 {
479
480 printf("ERROR!\n");
481 test_control_return(1);
482 }
483
484 /* Modify the first packet prepend and append. */
485 my_packet1 -> nx_packet_prepend_ptr = my_packet1 -> nx_packet_append_ptr;
486 my_packet1 -> nx_packet_length = TEST_SIZE;
487
488 /* Copy the packet . */
489 status = nx_packet_copy(my_packet1, &my_packet2, &pool_1, NX_NO_WAIT);
490
491 /* Check the status. */
492 if(status)
493 {
494
495 printf("ERROR!\n");
496 test_control_return(1);
497 }
498 #endif
499
500 /* Release the packet. */
501 nx_packet_release(my_packet1);
502
503 /* Allocate the packet. */
504 status = nx_packet_allocate(&pool_0, &my_packet1, 0, NX_NO_WAIT);
505
506 /* Check for error. */
507 if (status)
508 {
509
510 printf("ERROR!\n");
511 test_control_return(1);
512 }
513
514 /* Construct the packet data. */
515 memcpy(my_packet1 -> nx_packet_prepend_ptr, "ABCDEFGHIJKLMNOPQRSTUVWXYZ ", 28);
516
517 /* Adjust the write pointer. */
518 my_packet1 -> nx_packet_append_ptr = my_packet1 -> nx_packet_prepend_ptr + 28;
519
520 /* Set the invalid length. */
521 my_packet1 -> nx_packet_length = 30;
522
523 /* Copy the packet when the pool size not enough. */
524 status = nx_packet_copy(my_packet1, &my_packet2, &pool_0, NX_NO_WAIT);
525
526 /* Check the status. */
527 if(!status)
528 {
529
530 printf("ERROR!\n");
531 test_control_return(1);
532 }
533
534 /* Retrieve the packet data. */
535 status = nx_packet_data_retrieve(my_packet1, buffer, &size);
536
537 /* Check the status. */
538 if(!status)
539 {
540
541 printf("ERROR!\n");
542 test_control_return(1);
543 }
544
545 /* Extract the packet with zero offset. */
546 status = nx_packet_data_extract_offset(my_packet1, 30, buffer, sizeof(buffer), &size);
547
548 /* Check the status. */
549 if(!status)
550 {
551
552 printf("ERROR!\n");
553 test_control_return(1);
554 }
555
556 /* Set the invalid packet length. */
557 my_packet1 -> nx_packet_length = 0;
558
559 /* Extract the packet with zero offset. */
560 status = nx_packet_data_extract_offset(my_packet1, 0, buffer, sizeof(buffer), &size);
561
562 /* Check the status. */
563 if(status)
564 {
565
566 printf("ERROR!\n");
567 test_control_return(1);
568 }
569
570 /* Set the valid packet length. */
571 my_packet1 -> nx_packet_length = 28;
572
573 /* Extract the packet with small buffer. */
574 status = nx_packet_data_extract_offset(my_packet1, 0, buffer, 26, &size);
575
576 /* Check the status. */
577 if(status)
578 {
579
580 printf("ERROR!\n");
581 test_control_return(1);
582 }
583
584 /* Release the packet. */
585 nx_packet_release(my_packet1);
586
587 #ifndef NX_DISABLE_PACKET_CHAIN
588
589 /* Allocate the packet. */
590 status = nx_packet_allocate(&pool_0, &my_packet1, 0, NX_NO_WAIT);
591
592 /* Check for error. */
593 if (status)
594 {
595
596 printf("ERROR!\n");
597 test_control_return(1);
598 }
599
600 /* Append data that is two packet size. */
601 status = nx_packet_data_append(my_packet1, buffer, TEST_SIZE * 2, &pool_0, NX_NO_WAIT);
602
603 /* Check the status. */
604 if(status)
605 {
606
607 printf("ERROR!\n");
608 test_control_return(1);
609 }
610
611 /* Extract the packet. */
612 status = nx_packet_data_extract_offset(my_packet1, TEST_SIZE, buffer, sizeof(buffer), &size);
613
614 /* Check the status. */
615 if(status)
616 {
617
618 printf("ERROR!\n");
619 test_control_return(1);
620 }
621
622 /* Extract the packet with small buffer. */
623 status = nx_packet_data_extract_offset(my_packet1, 0, buffer, TEST_SIZE, &size);
624
625 /* Check the status. */
626 if(status)
627 {
628
629 printf("ERROR!\n");
630 test_control_return(1);
631 }
632
633 /* Set the invalid length. */
634 my_packet1 -> nx_packet_length = TEST_SIZE * 3;
635
636 /* Extract the packet with invalid length. */
637 status = nx_packet_data_extract_offset(my_packet1, TEST_SIZE * 2, buffer, sizeof(buffer), &size);
638
639 /* Check the status. */
640 if(!status)
641 {
642
643 printf("ERROR!\n");
644 test_control_return(1);
645 }
646
647 /* Reset the packet length. */
648 my_packet1 -> nx_packet_length = TEST_SIZE * 2;
649
650 /* Try to release this packet. */
651 status = nx_packet_release(my_packet1);
652
653 /* Check for error. */
654 if (status)
655 {
656
657 printf("ERROR!\n");
658 test_control_return(1);
659 }
660 #endif
661
662
663 #ifndef NX_DISABLE_ERROR_CHECKING
664 /* Allocate the packet with large packet type. */
665 status = nx_packet_allocate(&pool_0, &my_packet1, (pool_0.nx_packet_pool_payload_size + 4), NX_NO_WAIT);
666
667 /* Check for error. */
668 if (status != NX_INVALID_PARAMETERS)
669 {
670
671 printf("ERROR!\n");
672 test_control_return(1);
673 }
674
675 /* Allocate the packet. */
676 status = nx_packet_allocate(&pool_0, &my_packet1, 0, NX_NO_WAIT);
677
678 /* Check for error. */
679 if (status)
680 {
681
682 printf("ERROR!\n");
683 test_control_return(1);
684 }
685
686 /* Modifed the pool owner. */
687 my_packet1 -> nx_packet_pool_owner = NX_NULL;
688
689 /* Try to release this packet. */
690 status = nx_packet_release(my_packet1);
691
692 /* Check for error. */
693 if (status != NX_PTR_ERROR)
694 {
695
696 printf("ERROR!\n");
697 test_control_return(1);
698 }
699
700 /* Modifed the pool owner ID. */
701 my_packet1 -> nx_packet_pool_owner = &pool_0;
702 my_packet1 -> nx_packet_pool_owner -> nx_packet_pool_id = 0;
703
704 /* Try to release this packet. */
705 status = nx_packet_release(my_packet1);
706
707 /* Check for error. */
708 if (status != NX_PTR_ERROR)
709 {
710
711 printf("ERROR!\n");
712 test_control_return(1);
713 }
714
715 /* Recover the pool ID. */
716 my_packet1 -> nx_packet_pool_owner -> nx_packet_pool_id = NX_PACKET_POOL_ID;
717
718 /* Try to release this packet. */
719 status = nx_packet_release(my_packet1);
720
721 /* Check for error. */
722 if (status)
723 {
724
725 printf("ERROR!\n");
726 test_control_return(1);
727 }
728 #endif
729
730 printf("SUCCESS!\n");
731 test_control_return(0);
732 }
733
734