VirtualBox

Changeset 18678 in vbox for trunk/src


Ignore:
Timestamp:
Apr 3, 2009 11:15:48 AM (16 years ago)
Author:
vboxsync
Message:

Storage/iSCSI: fix one case where re-login failed, and also implement basic NOP-In handling in case the target wants to ping the initiator.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Storage/ISCSIHDDCore.cpp

    r18507 r18678  
    16001600                 * This also handles the connection reestablishment (login etc.). */
    16011601                RTThreadSleep(500);
     1602                if (   pImage->state != ISCSISTATE_IN_LOGIN
     1603                    && pImage->state != ISCSISTATE_IN_LOGOUT)
     1604                {
     1605                    /* Attempt to re-login when a connection fails, but only when not
     1606                     * currently logging in or logging out. */
     1607                    rc = iscsiAttach(pImage);
     1608                    if (RT_FAILURE(rc))
     1609                        break;
     1610                }
    16021611                if (pImage->paCurrReq != NULL)
    16031612                {
     
    16961705                    paRes[i].cbSeg = 0;
    16971706                break;
     1707            }
     1708            else if (   cmd == ISCSIOP_NOP_IN
     1709                     && RT_N2H_U32(pcvResSeg[5]) != ISCSI_TASK_TAG_RSVD)
     1710            {
     1711                const uint32_t *pcvResSeg = (const uint32_t *)aResBuf.pvSeg;
     1712                uint32_t cnISCSIReq;
     1713                ISCSIREQ aISCSIReq[4];
     1714                uint32_t aReqBHS[12];
     1715
     1716                aReqBHS[0] = RT_H2N_U32(ISCSI_IMMEDIATE_DELIVERY_BIT | ISCSI_FINAL_BIT | ISCSIOP_NOP_OUT);
     1717                aReqBHS[1] = RT_H2N_U32(0); /* TotalAHSLength=0,DataSementLength=0 */
     1718                aReqBHS[2] = pcvResSeg[2];      /* copy LUN from NOP-In */
     1719                aReqBHS[3] = pcvResSeg[3];      /* copy LUN from NOP-In */
     1720                aReqBHS[4] = RT_H2N_U32(ISCSI_TASK_TAG_RSVD); /* ITT, reply */
     1721                aReqBHS[5] = pcvResSeg[5];      /* copy TTT from NOP-In */
     1722                aReqBHS[6] = RT_H2N_U32(pImage->CmdSN);
     1723                aReqBHS[7] = RT_H2N_U32(pImage->ExpStatSN);
     1724                aReqBHS[8] = 0;             /* reserved */
     1725                aReqBHS[9] = 0;             /* reserved */
     1726                aReqBHS[10] = 0;            /* reserved */
     1727                aReqBHS[11] = 0;            /* reserved */
     1728
     1729                cnISCSIReq = 0;
     1730                aISCSIReq[cnISCSIReq].pcvSeg = aReqBHS;
     1731                aISCSIReq[cnISCSIReq].cbSeg = sizeof(aReqBHS);
     1732                cnISCSIReq++;
     1733
     1734                iscsiSendPDU(pImage, aISCSIReq, cnISCSIReq);
    16981735            }
    16991736        }
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette