diff options
| author | Yuxin Zhou <[email protected]> | 2021-07-28 07:24:24 +0000 |
|---|---|---|
| committer | Yuxin Zhou <[email protected]> | 2021-07-28 07:24:24 +0000 |
| commit | cb2245c8d1041d8250df797dd145091d08cd194c (patch) | |
| tree | 939ad587587d3169c5b3360610a95798e979fbf8 /common/src/nx_tcp_socket_state_data_check.c | |
| parent | c187d60014b149ee7c5e79b4d84c416caddbdef7 (diff) | |
Release 6.1.8v6.1.8_rel
Diffstat (limited to 'common/src/nx_tcp_socket_state_data_check.c')
| -rw-r--r-- | common/src/nx_tcp_socket_state_data_check.c | 55 |
1 files changed, 43 insertions, 12 deletions
diff --git a/common/src/nx_tcp_socket_state_data_check.c b/common/src/nx_tcp_socket_state_data_check.c index 1f6475d1..d23b6c21 100644 --- a/common/src/nx_tcp_socket_state_data_check.c +++ b/common/src/nx_tcp_socket_state_data_check.c @@ -276,7 +276,7 @@ ULONG work_length; /* FUNCTION RELEASE */ /* */ /* _nx_tcp_socket_state_data_check PORTABLE C */ -/* 6.1 */ +/* 6.1.8 */ /* AUTHOR */ /* */ /* Yuxin Zhou, Microsoft Corporation */ @@ -317,6 +317,9 @@ ULONG work_length; /* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ /* 09-30-2020 Yuxin Zhou Modified comment(s), */ /* resulting in version 6.1 */ +/* 08-02-2021 Yuxin Zhou Modified comment(s), and */ +/* supported TCP/IP offload, */ +/* resulting in version 6.1.8 */ /* */ /**************************************************************************/ UINT _nx_tcp_socket_state_data_check(NX_TCP_SOCKET *socket_ptr, NX_PACKET *packet_ptr) @@ -339,6 +342,9 @@ ULONG trim_data_length; TX_THREAD *thread_ptr; ULONG acked_packets = 0; UINT need_ack = NX_FALSE; +#ifdef NX_ENABLE_TCPIP_OFFLOAD +ULONG tcpip_offload; +#endif /* NX_ENABLE_TCPIP_OFFLOAD */ #ifdef NX_ENABLE_LOW_WATERMARK UCHAR drop_packet = NX_FALSE; #endif /* NX_ENABLE_LOW_WATERMARK */ @@ -349,6 +355,10 @@ NX_IP *ip_ptr; ip_ptr = socket_ptr -> nx_tcp_socket_ip_ptr; #endif +#ifdef NX_ENABLE_TCPIP_OFFLOAD + tcpip_offload = socket_ptr -> nx_tcp_socket_connect_interface -> nx_interface_capability_flag & + NX_INTERFACE_CAPABILITY_TCPIP_OFFLOAD; +#endif /* NX_ENABLE_TCPIP_OFFLOAD */ /* Pickup the pointer to the head of the TCP packet. */ /*lint -e{927} -e{826} suppress cast of pointer to pointer, since it is necessary */ @@ -370,7 +380,11 @@ NX_IP *ip_ptr; packet_end_sequence = tcp_header_ptr -> nx_tcp_sequence_number + packet_data_length; /* Trim the data that out of the receive window, make sure all data are in receive window. */ - if (packet_data_length) + if (packet_data_length +#ifdef NX_ENABLE_TCPIP_OFFLOAD + && (!tcpip_offload) +#endif /* NX_ENABLE_TCPIP_OFFLOAD */ + ) { /* Step1. trim the data on the left side of the receive window. */ @@ -480,13 +494,17 @@ NX_IP *ip_ptr; search_end_sequence = socket_ptr -> nx_tcp_socket_rx_sequence; } -#ifdef NX_ENABLE_LOW_WATERMARK /* Does the number of queued packets exceed the maximum rx queue length, or the number of * available packets in the default packet pool reaches low watermark? */ - if ((socket_ptr -> nx_tcp_socket_receive_queue_count >= - socket_ptr -> nx_tcp_socket_receive_queue_maximum) || - (packet_ptr -> nx_packet_pool_owner -> nx_packet_pool_available < - packet_ptr -> nx_packet_pool_owner -> nx_packet_pool_low_watermark)) +#ifdef NX_ENABLE_LOW_WATERMARK + if (((socket_ptr -> nx_tcp_socket_receive_queue_count >= + socket_ptr -> nx_tcp_socket_receive_queue_maximum) || + (packet_ptr -> nx_packet_pool_owner -> nx_packet_pool_available < + packet_ptr -> nx_packet_pool_owner -> nx_packet_pool_low_watermark)) +#ifdef NX_ENABLE_TCPIP_OFFLOAD + && (!tcpip_offload) +#endif /* NX_ENABLE_TCPIP_OFFLOAD */ + ) { /* Yes it is. The last packet in queue should be dropped. */ @@ -497,8 +515,12 @@ NX_IP *ip_ptr; /* Determine if we have a simple case of TCP data coming in the correct order. This means the socket's sequence number matches the incoming packet sequence number and the last packet's data on the socket's receive queue (if any) matches the current sequence number. */ - if ((tcp_header_ptr -> nx_tcp_sequence_number == socket_ptr -> nx_tcp_socket_rx_sequence) && - (search_end_sequence == socket_ptr -> nx_tcp_socket_rx_sequence)) + if (((tcp_header_ptr -> nx_tcp_sequence_number == socket_ptr -> nx_tcp_socket_rx_sequence) && + (search_end_sequence == socket_ptr -> nx_tcp_socket_rx_sequence)) +#ifdef NX_ENABLE_TCPIP_OFFLOAD + || tcpip_offload +#endif /* NX_ENABLE_TCPIP_OFFLOAD */ + ) { /* Yes, this is the simple case of adding receive packets in sequence. */ @@ -534,7 +556,12 @@ NX_IP *ip_ptr; socket_ptr -> nx_tcp_socket_receive_queue_tail = packet_ptr; /* Setup a new delayed ACK timeout. */ - socket_ptr -> nx_tcp_socket_delayed_ack_timeout = _nx_tcp_ack_timer_rate; +#ifdef NX_ENABLE_TCPIP_OFFLOAD + if (!tcpip_offload) +#endif /* NX_ENABLE_TCPIP_OFFLOAD */ + { + socket_ptr -> nx_tcp_socket_delayed_ack_timeout = _nx_tcp_ack_timer_rate; + } } /* Increment the receive TCP packet count. */ @@ -1059,7 +1086,7 @@ NX_IP *ip_ptr; /* At this point, we can use the packet TCP header pointers since the received packet is already queued. */ - /* Any packets for receving? */ + /* Any packets for receiving? */ while (acked_packets && socket_ptr -> nx_tcp_socket_receive_suspension_list) { @@ -1134,7 +1161,11 @@ NX_IP *ip_ptr; /* If the incoming packet caused the sequence number to move forward, indicating the new piece of data is in order, in sequence, and valid for receiving. */ - if (original_rx_sequence != socket_ptr -> nx_tcp_socket_rx_sequence) + if ((original_rx_sequence != socket_ptr -> nx_tcp_socket_rx_sequence) +#ifdef NX_ENABLE_TCPIP_OFFLOAD + || tcpip_offload +#endif /* NX_ENABLE_TCPIP_OFFLOAD */ + ) { /* Determine if there is a socket receive notification function specified. */ if (socket_ptr -> nx_tcp_receive_callback) |
