diff options
| author | TiejunZhou <[email protected]> | 2023-12-27 05:56:27 +0000 |
|---|---|---|
| committer | TiejunZhou <[email protected]> | 2023-12-27 05:56:27 +0000 |
| commit | 1dd1bc741a2f9595f6c416c33575b49bbc13d792 (patch) | |
| tree | 363b7ad6eddf056bcccfebce64f3fb6cfe7b0d92 | |
| parent | 6d8578f615e96f1e5133a99fa575893020130f01 (diff) | |
Fix regression test
| -rw-r--r-- | common/src/nx_link.c | 14 | ||||
| -rw-r--r-- | common/src/nx_ram_network_driver.c | 1 | ||||
| -rw-r--r-- | test/regression/netxduo_test/netx_ip_max_payload_size_find_test.c | 10 | ||||
| -rw-r--r-- | test/regression/netxduo_test/netx_udp_packet_type_test.c | 4 | ||||
| -rw-r--r-- | test/regression/test/nx_ram_network_driver_test_1500.c | 2 |
5 files changed, 14 insertions, 17 deletions
diff --git a/common/src/nx_link.c b/common/src/nx_link.c index 917efb85..806ec91e 100644 --- a/common/src/nx_link.c +++ b/common/src/nx_link.c @@ -1082,7 +1082,7 @@ ULONG header_length; /* ip_ptr IP instance pointer */ /* interface_index Index to the interface */ /* packet_ptr Pointer to packet */ -/* time_ptr Timestamp of packet recceived */ +/* time_ptr Timestamp of packet received */ /* */ /* OUTPUT */ /* */ @@ -1090,8 +1090,6 @@ ULONG header_length; /* */ /* CALLS */ /* */ -/* tx_mutex_get Get protection mutex */ -/* tx_mutex_put Put protection mutex */ /* _nx_packet_release Release packet */ /* nx_link_ethernet_header_parse Parse Ethernet header */ /* _nx_ip_packet_deferred_receive IP packet receive */ @@ -1125,16 +1123,17 @@ NX_LINK_RECEIVE_QUEUE *queue_ptr; /* Check for invalid input pointers. */ if ((ip_ptr == NX_NULL) || (ip_ptr -> nx_ip_id != NX_IP_ID) || (packet_ptr == NX_NULL)) { + _nx_packet_release(packet_ptr); return; } /* Check for interface being valid. */ if (!ip_ptr -> nx_ip_interface[interface_index].nx_interface_valid) { + _nx_packet_release(packet_ptr); return; } - tx_mutex_get(&(ip_ptr -> nx_ip_protection), TX_WAIT_FOREVER); interface_ptr = &(ip_ptr -> nx_ip_interface[interface_index]); queue_ptr = interface_ptr -> nx_interface_link_receive_queue_head; @@ -1165,7 +1164,6 @@ NX_LINK_RECEIVE_QUEUE *queue_ptr; /* Drop the packet. */ _nx_packet_release(packet_ptr); - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); return; } @@ -1183,7 +1181,6 @@ NX_LINK_RECEIVE_QUEUE *queue_ptr; /* Drop the packet. */ _nx_packet_release(packet_ptr); - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); return; } @@ -1217,7 +1214,6 @@ NX_LINK_RECEIVE_QUEUE *queue_ptr; /* Drop the packet. */ _nx_packet_release(packet_ptr); - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); return; } @@ -1308,7 +1304,6 @@ NX_LINK_RECEIVE_QUEUE *queue_ptr; { /* Packet was consumed. */ - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); return; } } @@ -1326,7 +1321,6 @@ NX_LINK_RECEIVE_QUEUE *queue_ptr; /* Invalid ethernet header... release the packet. */ _nx_packet_release(packet_ptr); } - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); } @@ -1572,7 +1566,7 @@ UINT nx_link_driver_request_preprocess(NX_IP_DRIVER *driver_request, NX_INTERFAC case NX_LINK_ENABLE: /* fallthrough */ case NX_LINK_DISABLE: /* fallthrough */ - /* The link status of virtual interface should be same with its parent phisical interface */ + /* The link status of virtual interface should be same with its parent physical interface */ case NX_LINK_SET_PHYSICAL_ADDRESS: /* fallthrough */ /* Set mac address is not supported for virtual interface */ case NX_LINK_RX_ENABLE: /* fallthrough */ diff --git a/common/src/nx_ram_network_driver.c b/common/src/nx_ram_network_driver.c index ba727eca..38111be5 100644 --- a/common/src/nx_ram_network_driver.c +++ b/common/src/nx_ram_network_driver.c @@ -396,6 +396,7 @@ ULONG *ethernet_frame_ptr; /* Release the packet. */ nx_packet_transmit_release(packet_ptr); + break; } #else diff --git a/test/regression/netxduo_test/netx_ip_max_payload_size_find_test.c b/test/regression/netxduo_test/netx_ip_max_payload_size_find_test.c index 1668eb3a..1822c35e 100644 --- a/test/regression/netxduo_test/netx_ip_max_payload_size_find_test.c +++ b/test/regression/netxduo_test/netx_ip_max_payload_size_find_test.c @@ -181,7 +181,7 @@ ULONG start_offset, payload_length; status = nx_ip_max_payload_size_find(&ip_0, &dest_address, 0, 80, 80, NX_PROTOCOL_TCP, &start_offset, &payload_length); - if((status != NX_SUCCESS) || (start_offset != 56) || (payload_length != 1460)) + if((status != NX_SUCCESS) || (start_offset != (40 + NX_PHYSICAL_HEADER)) || (payload_length != 1460)) { printf("ERROR!\n"); test_control_return(1); @@ -193,7 +193,7 @@ ULONG start_offset, payload_length; status = nx_ip_max_payload_size_find(&ip_0, &dest_address, 1, 80, 80, NX_PROTOCOL_TCP, &start_offset, &payload_length); - if((status != NX_SUCCESS) ||(start_offset != 56) || (payload_length != 472)) + if((status != NX_SUCCESS) ||(start_offset != (40 + NX_PHYSICAL_HEADER)) || (payload_length != 472)) { printf("ERROR!\n"); test_control_return(1); @@ -218,7 +218,7 @@ ULONG start_offset, payload_length; status = nx_ip_max_payload_size_find(&ip_1, &dest_address, 0, 80, 80, NX_PROTOCOL_TCP, &start_offset, &payload_length); - if((status != NX_SUCCESS) || (start_offset != 56) || (payload_length != 984)) + if((status != NX_SUCCESS) || (start_offset != (40 + NX_PHYSICAL_HEADER)) || (payload_length != 984)) { printf("ERROR!\n"); test_control_return(1); @@ -232,7 +232,7 @@ ULONG start_offset, payload_length; &start_offset, &payload_length); /* 56 = 16 + 20 + 20. 216 = 256 + 16 - 56 */ - if((status != NX_SUCCESS) ||(start_offset != 56) || (payload_length != 216)) + if((status != NX_SUCCESS) ||(start_offset != (40 + NX_PHYSICAL_HEADER)) || (payload_length != 216)) { printf("ERROR!\n"); test_control_return(1); @@ -251,7 +251,7 @@ ULONG start_offset, payload_length; /* Find the max payload with valid address index. */ status = nx_ip_max_payload_size_find(&ip_0, &ipv6_address_1, 0, 80, 80, NX_PROTOCOL_UDP, &start_offset, &payload_length); /* 64 = 16 + 40 + 8 208 = 1500 + 16 - 64 */ - if((status != NX_SUCCESS) || (start_offset != 64) || (payload_length != 1452)) + if((status != NX_SUCCESS) || (start_offset != (48 + NX_PHYSICAL_HEADER)) || (payload_length != 1452)) { printf("ERROR!\n"); test_control_return(1); diff --git a/test/regression/netxduo_test/netx_udp_packet_type_test.c b/test/regression/netxduo_test/netx_udp_packet_type_test.c index 196927d6..ce995469 100644 --- a/test/regression/netxduo_test/netx_udp_packet_type_test.c +++ b/test/regression/netxduo_test/netx_udp_packet_type_test.c @@ -194,7 +194,7 @@ NX_PACKET *my_packet; /**************************/ /* Allocate a packet that can fill the UDP header, IPv4 header and physical header. */ - status = nx_packet_allocate(&pool_0, &my_packet, 8 + 20 + 16, TX_WAIT_FOREVER); + status = nx_packet_allocate(&pool_0, &my_packet, 8 + 20 + NX_PHYSICAL_HEADER, TX_WAIT_FOREVER); /* Check status. */ if (status != NX_SUCCESS) @@ -328,7 +328,7 @@ NX_PACKET *my_packet; /**************************/ /* Allocate a packet that can fill the UDP header, IPv6 header and physical header. */ - status = nx_packet_allocate(&pool_0, &my_packet, 8 + 40 + 16, TX_WAIT_FOREVER); + status = nx_packet_allocate(&pool_0, &my_packet, 8 + 40 + NX_PHYSICAL_HEADER, TX_WAIT_FOREVER); /* Check status. */ if (status != NX_SUCCESS) diff --git a/test/regression/test/nx_ram_network_driver_test_1500.c b/test/regression/test/nx_ram_network_driver_test_1500.c index a497b46a..03beb552 100644 --- a/test/regression/test/nx_ram_network_driver_test_1500.c +++ b/test/regression/test/nx_ram_network_driver_test_1500.c @@ -791,6 +791,7 @@ USHORT ether_type; /* Release the packet. */ nx_packet_transmit_release(packet_ptr); + break; } #else /* Adjust the prepend pointer. */ @@ -1322,6 +1323,7 @@ USHORT ether_type; /* Release the packet. */ nx_packet_transmit_release(packet_ptr); + break; } #else /* Adjust the prepend pointer. */ |
