The UDP/IP stub will primarily consist of two user level daemons, one which sends UDP messages to desired destination and the other which receives UDP messages. A user-level implementation of UDP/IP stub seems the best for the following reasons
This daemon receives datagrams over a UDP socket. In the actual myrinet driver implementation, the driver queues the packet from within interrupt service routine and marks the appropriate CSKM/SSKM's bottom half to execute. To emulate this behaviour, after receiving a packet over UDP socket, the receive daemon makes a system callprocess_packet( received_packet, source_of_packet). received_packet is assumed to be a fully formed myrinet packet. This system call does the following
- Looks at the packet structure to determine whether the packet is intended for CSKM or SSKM
- Correspondingly calls cskm_rcv() or sskm_rcv(),which in turn queue the packet in CSKM/SSKM receive queues and directly call the routine (cskm_bh() or sskm_bh() ) that is intended to do the bottom half processing . ( This emulates the behaviour of actual bottom half executing immediately after completion of interrupt service routine.
This daemon's job is to send the messages handed over by CSKM/SSKM. The send daemon is a process which loops at the user level calling pick_packet_to_send(packet, destination_of_packet) system call in every iteration.
- The system call waits for messages from CSKM/SSKM in the kernel if none are available.
- CSKM and SSKM will call
myri_send_datagram(int receiver_id, int receiver_module, MSG *payload) to queue the packets they want to send to some destination. This function is a modified version of the actual interface provided by myrinet HSN. The difference between myrinet version and udp-ip version is that in the latter, apart from enqueuing the packet in a send queue, the act of enqueuing will wake up the send daemon.
- The woken up send daemon, which was earlier waiting in pick_packet_to_send(), now dequeues a packet and returns to the user mode with the packet.
- This packet is sent to the destination over the UDP socket.