I currently have a problem where I am dropping udp receive packets.
The target C6670 with the EVM board. NDK 2.22.03.20
I have the problem with NC_SystemOpen( NC_PRIORITY_LOW, NC_OPMODE_POLLING) but also see the problem with priority high and interrupt.
I spun up a udp thread/task at priority 7 calling recvfrom() in a blocking mode. It gets the packet and then echoes it back. I have traced the dropped packet down to the fact the receive socket bufffer is full.
What I see happening when a udp packet arrives:
UdpInput runs to the end of the function and calls
SockNotify, which runs and calls
FdSignalEvent, which calls
fdint_signal_event, that calls
SemPost
At this point, I expected a task sswitch to my UDP task that is waiting on this socket. This doesn't happen. Another receive packet come in starting with UdpInput as described above. Then the third and fourth packets come in. Some times, my task runs and processes all 4 packets, but other times a fifth packet calls UdpInput and then the socket buffer is full and the packet is discarded.
If I set breakpoints at UdpInput and the after my call to recvfrom(), I consistently get multiple hits at the UdpInput breakpoint before I see one in my thread after recvfrom.
So my question is:
Why is there not a task switch after every incoming packet is processed by the stack and the task is SockNotify/SemPost that the task has data and is ready to run?
The task is of a higher priority than the network stack, so I expect it to preempt the network stack and run.
Any ideas?
Thanks
Milan


