Hi group,

I'm looking at the following code and come up with some questions....

In this function,

static void iscsi_sw_tcp_write_space(struct sock *sk)
{
        struct iscsi_conn *conn = (struct iscsi_conn*)sk->sk_user_data;
        struct iscsi_tcp_conn *tcp_conn = conn->dd_data;
        struct iscsi_sw_tcp_conn *tcp_sw_conn = tcp_conn->dd_data;

        tcp_sw_conn->old_write_space(sk);
        ISCSI_SW_TCP_DBG(conn, "iscsi_write_space\n");
        iscsi_conn_queue_work(conn);
}

tcp_sw_conn->old_write_space() is called. And in the following
function, tcp_sw_conn->old_write_space() seems to be assigned to the
original value of "sk->sk_write_space"...

Could anyone show me which function does "sk->sk_write_space" point to
before it is assigned to "iscsi_sw_tcp_write_space;" later in the same
function?

static void iscsi_sw_tcp_conn_set_callbacks(struct iscsi_conn *conn)
{
        struct iscsi_tcp_conn *tcp_conn = conn->dd_data;
        struct iscsi_sw_tcp_conn *tcp_sw_conn = tcp_conn->dd_data;
        struct sock *sk = tcp_sw_conn->sock->sk;

        /* assign new callbacks */
        ......
        tcp_sw_conn->old_write_space = sk->sk_write_space;

// assignment of "sk->sk_write_space" but after its value was assigned
to "tcp_sw_conn->old_write_space"...

        sk->sk_write_space = iscsi_sw_tcp_write_space;
        write_unlock_bh(&sk->sk_callback_lock);
}

Another question is: Now that we have "sk->sk_write_space =
iscsi_sw_tcp_write_space" why do we have to call "tcp_sw_conn-
>old_write_space(sk);" in "iscsi_sw_tcp_write_space()"? Which function
is actually called when we do "tcp_sw_conn->old_write_space(sk);"?

And also in fuction "static void iscsi_sw_tcp_write_space(struct sock
*sk)", the last instruction is "iscsi_conn_queue_work(conn);". When I
trace down I found

inline void iscsi_conn_queue_work(struct iscsi_conn *conn)
{
        struct Scsi_Host *shost = conn->session->host;
        struct iscsi_host *ihost = shost_priv(shost);

        if (ihost->workq)
                queue_work(ihost->workq, &conn->xmitwork);
}

But I couldn't find more details about "queue_work(ihost->workq, &conn-
>xmitwork);" in the source code (ver 2.0.871). Could anyone maybe
point me to the code of "queu_work"?

And what exactly is done when we call "static void
iscsi_sw_tcp_write_space(struct sock *sk)"?
I'm guessing handing over some PDUs to TCP, but couldn't find anything
relevant in the source code (ver 2.0.871)....

Sorry for so many questions....

Any help would be highly appreciated.

Thanks a lot,

Jack

-- 
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