This is somewhat tricky. The priority associated with the skb is used when messages are loaded by the tx function. The skb maintains an array of 16 linked lists of messages (one for each priority). When you add a new message to the skb it puts in on the right array based on the priority in the header of the message (see __rtskb_prio_queue_head() as an example). Then, when messages are sent they are pulled from the highest priority array that has a message on it (see __rtskb_prio_dequeue() and note that ffz() is a linux util func that finds the first bit set and returns its index). There is an ioctl(RTNET_RTIOC_XMITPARAMS) call to set the priority of a socket. The low order word of the value sent down sets the skb's priority for that socket. When that socket writes a message to the skb it puts its priority in the header of the message. (see rt_socket_init() for the initial assignment of the priority and rt_packet_sendmsg() in af_packet.c for where this is then put in the header of the message). Thus, you can define multiple sockets and give them different priorities and the messages from the highest priority socket make it out first. The high order word of the ioctl(RTNET_RTIOC_XMITPARAMS) defines the slot or channel that the socket is associated with (see RTSKB_PRIO_VALUE(priority, channel)). This basically assigns when in the cycle messages sent from a given socket go out. If you have multiple slots for a given node, you can allocate different sockets to different slots and they will not collide or compete with each other. This is handled in the function tdma_ioctl_set_slot(). Each slot gets a 'job' associated with it and those jobs are then used to trigger sleep/wake type interrupts to send messages. (see http://www.rtai.dk/cgi-bin/gratiswiki.pl?RTnet for more of an explanation). Although they are in number order (0,1,2,...) slots really get sorted by their offset from the sync frame. Only under the bizarre situation of two slots with identical offsets is the one with the lowest index treated as 'higher priority'. Thus, the slot index should not really be thought of as a priority in the normal sense. Note also that slot 1 is special since it is the default non-realtime (NRT) slot used by the vnic linux driver. If you don't define slot 1 then the system automatically puts its messages on slot 0's skb.
As I state in the link above, I'm in the process of added the flexibility to associate several slots to the same skb and hence to the same socket. Thus allowing a single socket to send messages out on any of multiple slots within a cycle. Hope this helps.... Regards, Bill Vareka Original message ----------------------------------------------------- Howard Cai Tue, 16 Aug 2005 19:02:37 -0700 Hi, Recently, I am studying the RTNET code and realized that there is a priority assied to each sock allocated and then to the related socket buffer (skb) for outgoing for example. But In the source code I have not found where this priority is used for the delivery of the packet? Did I miss something at somewhere? Can anybody give a hints on this? Thanks, Howard. ------------------------------------------------------- SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf _______________________________________________ RTnet-users mailing list RTnet-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rtnet-users