Hi ,
Can someone please explain the nwk_Qfindoldest?
1) whats the logic flow inside this?
2) whats the purpose and usage of this function?
3) whats the relationship beteween it and nwk_findslot?
Thanks,
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi ,
Can someone please explain the nwk_Qfindoldest?
1) whats the logic flow inside this?
2) whats the purpose and usage of this function?
3) whats the relationship beteween it and nwk_findslot?
Thanks,
The purpose of this function is to locate the oldest received frame for the given link ID. If there are no frames in the receive queue for this link or the queue is empty, then a null pointer is returned.
The flow is as follows
The purpose of the function is to manage the order in which packets are given to a connection end (i.e. the LID requesting the packet). There is additional work here because the nwk applications do not create links but work on an effective static link implied by the port addressed. In either case, we want to make sure the packets are retrieved in the order received and the oldest packet in the queue (for the requested LID/Port) will be the first one passed back to the application. This is necessary as there is no guarantee only one packet will be received on a given connection before the destination application can retrieve it. i.e. there can be multiple packets in the queue for a single destination.
The find slot function locates a free entry in the receive queue so the current message being received by the radio can be placed in the queue. the relationship of this function to the find oldest function is roughly similar to a head and tail pointer in a ring buffer. However, since the receive queue handles packets for all links/ports, and there is no restriction of the order in which links/ports retrieve packets from the frame, the single receive queue effectively operates as multiple ring buffers in parallel but by combining them all into a single queue maximizes memory usage in general.
Jim Noxon