Hi,
the NDK and TI's packet drivers are designed to drop transmit packets if the device's transmit buffers are full. This can cause undesired behaviour of TCP and UDP sockets, if the CPU is putting packets to the TX queue faster than the link can handle.
For UDP sockets, if the application sends multiple packets at once, packets will be randomly dropped without any notification to the application. I know that UDP packed delivery is unreliable by definition, but a blocking behaviour of the sendto() function or returning EWOULDBLOCK for non-blocking sockets would be much better in my opinion.
This problem can also cause a huge performance impact for TCP if the transmit buffers are depleted. For example, the NIMU packet driver in the C66-MCSDK uses only 16 transmit buffers. If the TCP transmit buffer is configured to hold 32kB of data, packets will be continuously be dropped. The TCP retransmission mechanism will keep the transmission reliable, but it also gets very slow. This problem can also occur if multiple TCP sockets are sending data simultaneously.
I think a cleaner solution than dropping the packets without notification would be to notify the UDP and TCP layers about the packet drop. Then these layers could decide to block until space gets available or to return an error to the application. But I also understand that this would be a major change to the NDK.
We worked around this problem by changing the packet driver: If the transmit buffer is full, we will spin in a loop until space gets available. It's not a very nice solution, but it seems to work.
Ralf