The following info is for the current open-iscsi code in git. It should be close to what is in 871.

On 01/26/2010 02:01 AM, Jack Z wrote:
******* function call trace for login *******

iscsiadm main()
exec_node_op()
login_portals()

This function does for_each_rec which will read in the rec info from the /etc/iscsi/node db.

__login_portals()
(use a function pointer) login_portal()
iscsid_req_by_rec_async() / iscsid_req_by_rec()

These functions will pass the rec that was read in to the iscsid.

iscsid_request()
// The direct function call chain ends here.
// the connection creation requst is now trasfered to the other end
// of the socket by IPC
// the code on the other hand will take over the connection
establishment task


IPC mechanism for user land

main() in iscsid.c calls mgmt_ipc_listen(void)
mgmt_ipc_listen(void) // creates and listens to the IPC socket, this
is the other end of the socket that was used in iscsid_connect
mgmt_ipc_listen(void) returns to main() the fd of the local socket
main() in iscsid.c uses the returned fd in event_loop()
event_loop() calls mgmt_ipc_handle with that fd (mgmt_ipc_fd)
mgmt_ipc_handle assign handler, a function pointer, an appropriate
function according to the command sent from the other end of the local
socket and user handler to handle it
in case of login, the function will be mgmt_ipc_session_login()
mgmt_ipc_session_login() then calls session_login_task()
session_login_task() does a series of session initiation and then
calls iscsi_conn_connect()
session_login_task() then use a function pointer, ep_connect, in the
struct iscsi_conn (conn->session->t->template->ep_connect(conn, 1)),
which is initialized by
struct iscsi_transport_template iscsi_tcp = {
  .name  = "tcp",
         // this is the connection function used in iscsi_conn_connect,
         // which is a function in initiator.c and can be traced from
         // mgmt_ipc_session_login, a function in mgmt_ipc.c
  .ep_connect = iscsi_io_tcp_connect,
  ....
};
so in case if iscsi_tcp, the function called by ep_connect is
iscsi_io_tcp_connect.
iscsi_io_tcp_connect then finally establishes the connection.


The connect is non blocking, so initiator.c will do

session_conn_poll()
...
        session->t->template->ep_poll(conn, 1);
...

When this is successful, then we do

session_conn_poll()
...
        session_ipc_create()
        // this calls into the kernel using the netlink interface.
        // It tells the kernel to create session struct.
....
        ipc->create_conn()
        // this calls into the kernel using the netlink interface.
        // It tells the kernel to create a conn struct for the session
....
        iscsi_copy_operational_params()
        // this function copies the rec values to a userspace conn/session 
struct
.....
        if (ipc->bind_conn()
......
// This tells the kernel to associate a endpoint (in this case for iscsi_tcp it will be a socket) with the conn and associate the conn with the session
........

        iscsi_login_req()
// This begins iscsi login. It will send iscsi login pdus to the target using the netlink interface. The kernel will then put the pdus on the wire. When the kernel gets a response it uses the netlink interface to pass the pdu response to iscsid. The netlink.c code will call iscsi_sched_ev_context to have iscsid to handle the event (in the case of a login response pdu we do the EV_CONN_RECV_PDU event).




session_conn_recv_pdu()
        // this is called to handle the login response.

        iscsi_recv_login_rsp()
// this then gets called to parse the pdu. If all goes well then we call (note we might have to send more pdus if CHAP is used for example)...
        setup_full_feature_phase()


setup_full_feature_phase()
// This is where finally we call into the kernel to tell it what settings to use for the now setup session.
        iscsi_session_set_params()
// This sets the session and connection settings using the netlink interface
                ipc->set_param()
// this calls into netlink.c and that code sends the kernel a set_param netlink message. The kernel driver will then catch the msg and set the setting.

        iscsi_host_set_params()
// this sets the host level settings using the netlink interface. It works like the session set param code.

        if (ipc->start_conn()
// this tells the kernel we have logged in and set params and to start doing io.


Let me know if you need more info.

--
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To post to this group, send email to open-is...@googlegroups.com.
To unsubscribe from this group, send email to 
open-iscsi+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/open-iscsi?hl=en.

Reply via email to