Hello,
While optimizing our embedded ethernet library (based on threadX and netxduo) a question arose.
Due to lack of SRAM on smaller devices, our MSS (and MTU) size is reduzed, to safe memory.
The used NX_PACKET_POOL has decreased size too, of course.
After appending Data to an empty allocated NX_PACKET, it is sent with nx_tcp_socket_send.
NX_PACKET - Size > MSS Size, so copy needed, everything fine.
If i append more data to the NX_PACKET, so that it is necessary to allocate a further NX_PACKET, and add it to a packetchain, all data copied because it is assumed to need to "readjust".
Why is a NX_PACKET chain, with packet sized, that will directly fits into MSS readjusted and copied into two other NX_PACKETS, without any reason?
Rootcause is this line from file nx_tcp_socket_send_internal.c line 497
/* Whether to adjust the packet? */
if (packet_ptr -> nx_packet_length > tx_window_current)
{
Problem is, that the whole packet size is checked, not the single NX_PAKET.
Am i missing something, or can this be optimized, by checking the size of every single packet? And only copy/adjust if it is really necessary.
Best Regards
Alexander Zorn
----------------------------------------------------------------------------------------------
Ing. Alexander ZORN
/ Software Developer - System Control Welding
/ Research & Development - Embedded Systems Engineering