Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/iscsi Make PDU init routines record serial number in...



details:   https://anonhg.NetBSD.org/src/rev/a368b36edca6
branches:  trunk
changeset: 815832:a368b36edca6
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Sun Jun 05 05:25:59 2016 +0000

description:
Make PDU init routines record serial number in CCB too.

diffstat:

 sys/dev/iscsi/iscsi_send.c |  30 ++++++++++++++++++------------
 1 files changed, 18 insertions(+), 12 deletions(-)

diffs (130 lines):

diff -r c45610fed2f6 -r a368b36edca6 sys/dev/iscsi/iscsi_send.c
--- a/sys/dev/iscsi/iscsi_send.c        Sun Jun 05 05:18:58 2016 +0000
+++ b/sys/dev/iscsi/iscsi_send.c        Sun Jun 05 05:25:59 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: iscsi_send.c,v 1.22 2016/06/05 05:18:58 mlelstv Exp $  */
+/*     $NetBSD: iscsi_send.c,v 1.23 2016/06/05 05:25:59 mlelstv Exp $  */
 
 /*-
  * Copyright (c) 2004,2005,2006,2011 The NetBSD Foundation, Inc.
@@ -619,11 +619,12 @@
  *
  *    Parameter:
  *          conn     The connection
+ *          ccb      The CCB
  *          pdu      The PDU
  */
 
 STATIC void
-init_login_pdu(connection_t *conn, pdu_t *ppdu, bool next)
+init_login_pdu(connection_t *conn, ccb_t *ccb, pdu_t *ppdu, bool next)
 {
        pdu_header_t *pdu = &ppdu->pdu;
        login_isid_t *isid = (login_isid_t *) & pdu->LUN;
@@ -631,6 +632,8 @@
 
        pdu->Opcode = IOP_Login_Request | OP_IMMEDIATE;
 
+       ccb->CmdSN = get_sernum(conn->session, false);
+
        if (next) {
                c_phase = (pdu->Flags >> CSG_SHIFT) & SG_MASK;
                pdu->Flags = FLAG_TRANSIT | (c_phase << CSG_SHIFT) |
@@ -641,7 +644,7 @@
        isid->TSIH = conn->session->TSIH;
 
        pdu->p.login_req.CID = htons(conn->id);
-       pdu->p.login_req.CmdSN = htonl(conn->session->CmdSN);
+       pdu->p.login_req.CmdSN = htonl(ccb->CmdSN);
 }
 
 
@@ -715,7 +718,7 @@
                wake_ccb(tx_ccb, rc);
                free_pdu(tx_pdu);
        } else {
-               init_login_pdu(conn, tx_pdu, next);
+               init_login_pdu(conn, tx_ccb, tx_pdu, next);
                setup_tx_uio(tx_pdu, tx_pdu->temp_data_len, tx_pdu->temp_data, FALSE);
                send_pdu(tx_ccb, tx_pdu, CCBDISP_NOWAIT, PDUDISP_FREE);
        }
@@ -728,18 +731,21 @@
  *
  *    Parameter:
  *          conn     The connection
+ *          ccb      The transmit CCB
  *          ppdu     The transmit PDU
  *          rx_pdu   The received PDU if this is an unsolicited negotiation
  */
 
 STATIC void
-init_text_pdu(connection_t *conn, pdu_t *ppdu, pdu_t *rx_pdu)
+init_text_pdu(connection_t *conn, ccb_t *ccb, pdu_t *ppdu, pdu_t *rx_pdu)
 {
        pdu_header_t *pdu = &ppdu->pdu;
 
        pdu->Opcode = IOP_Text_Request | OP_IMMEDIATE;
        pdu->Flags = FLAG_FINAL;
 
+       ccb->CmdSN = get_sernum(conn->session, false);
+
        if (rx_pdu != NULL) {
                pdu->p.text_req.TargetTransferTag =
                        rx_pdu->pdu.p.text_rsp.TargetTransferTag;
@@ -747,7 +753,7 @@
        } else
                pdu->p.text_req.TargetTransferTag = 0xffffffff;
 
-       pdu->p.text_req.CmdSN = htonl(conn->session->CmdSN);
+       pdu->p.text_req.CmdSN = htonl(ccb->CmdSN);
 }
 
 
@@ -772,9 +778,9 @@
 
        if (rx_pdu != NULL &&
                (rx_pdu->pdu.Opcode & OPCODE_MASK) == IOP_Login_Request)
-               init_login_pdu(conn, tx_pdu, FALSE);
+               init_login_pdu(conn, tx_ccb, tx_pdu, FALSE);
        else
-               init_text_pdu(conn, tx_pdu, rx_pdu);
+               init_text_pdu(conn, tx_ccb, tx_pdu, rx_pdu);
 
        setup_tx_uio(tx_pdu, 0, NULL, FALSE);
        send_pdu(tx_ccb, tx_pdu, CCBDISP_NOWAIT, PDUDISP_FREE);
@@ -810,7 +816,7 @@
                return;
        }
 
-       init_text_pdu(conn, pdu, NULL);
+       init_text_pdu(conn, ccb, pdu, NULL);
        setup_tx_uio(pdu, 0, NULL, FALSE);
        send_pdu(ccb, pdu, CCBDISP_FREE, PDUDISP_WAIT);
 }
@@ -856,7 +862,7 @@
 
                        handle_connection_error(conn, rc, LOGOUT_CONNECTION);
                } else if (tx_pdu != NULL) {
-                       init_text_pdu(conn, tx_pdu, rx_pdu);
+                       init_text_pdu(conn, tx_ccb, tx_pdu, rx_pdu);
                        setup_tx_uio(tx_pdu, tx_pdu->temp_data_len, tx_pdu->temp_data,
                                                 FALSE);
                        send_pdu(tx_ccb, tx_pdu, CCBDISP_NOWAIT, PDUDISP_FREE);
@@ -912,7 +918,7 @@
                return rc;
        }
 
-       init_text_pdu(conn, pdu, NULL);
+       init_text_pdu(conn, ccb, pdu, NULL);
 
        setup_tx_uio(pdu, pdu->temp_data_len, pdu->temp_data, FALSE);
        send_pdu(ccb, pdu, CCBDISP_WAIT, PDUDISP_WAIT);
@@ -1122,7 +1128,7 @@
        }
 
        if ((rc = assemble_login_parameters(conn, ccb, pdu)) <= 0) {
-               init_login_pdu(conn, pdu, !rc);
+               init_login_pdu(conn, ccb, pdu, !rc);
                setup_tx_uio(pdu, pdu->temp_data_len, pdu->temp_data, FALSE);
                send_pdu(ccb, pdu, CCBDISP_WAIT, PDUDISP_FREE);
                rc = ccb->status;



Home | Main Index | Thread Index | Old Index