VirtualBox

Changeset 32225 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Sep 2, 2010 8:07:53 PM (14 years ago)
Author:
vboxsync
Message:

iSCSI: Don't send more PDUs then allowed by the target. The MaxCmdSN parameter gives the maximum command sequence number it allows

File:
1 edited

Legend:

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

    r32132 r32225  
    475475    /** The BHS. */
    476476    uint32_t    aBHS[12];
     477    /** Assigned CmdSN for this PDU. */
     478    uint32_t    CmdSN;
    477479    /** The S/G buffer used for sending. */
    478480    RTSGBUF     SgBuf;
     
    690692/* Serial number arithmetic comparison. */
    691693static bool serial_number_less(uint32_t sn1, uint32_t sn2);
     694static bool serial_number_greater(uint32_t sn1, uint32_t sn2);
    692695
    693696/* CHAP-MD5 functions. */
     
    22952298    do
    22962299    {
    2297         /* If there is no PDU active, get the first one from the list. */
     2300        /*
     2301         * If there is no PDU active, get the first one from the list.
     2302         * Check that we are allowed to transfer the PDU by comparing the
     2303         * command sequence number and the maximum sequence number allowed by the target.
     2304         */
    22982305        if (!pImage->pIScsiPDUTxCur)
    22992306        {
    2300             if (!pImage->pIScsiPDUTxHead)
     2307            if (   !pImage->pIScsiPDUTxHead
     2308                || serial_number_greater(pImage->pIScsiPDUTxHead->CmdSN, pImage->MaxCmdSN))
    23012309                break;
    23022310
     
    24172425                 */
    24182426                rc = iscsiRecvPDUUpdateRequest(pImage, paRes, cnRes);
     2427                /* Try to send more PDUs now that we updated the MaxCmdSN field */
     2428                if (   RT_SUCCESS(rc)
     2429                    && !pImage->pIScsiPDUTxCur)
     2430                    rc = iscsiSendPDUAsync(pImage);
    24192431            }
    24202432            else
     
    26192631    paReqBHS[7] = RT_H2N_U32(pImage->ExpStatSN);
    26202632    memcpy(paReqBHS + 8, pScsiReq->pvCmd, pScsiReq->cbCmd);
     2633
     2634    pIScsiPDU->CmdSN = pImage->CmdSN;
    26212635    pImage->CmdSN++;
    26222636
     
    30353049{
    30363050    return (s1 < s2 && s2 - s1 < 0x80000000) || (s1 > s2 && s1 - s2 > 0x80000000);
     3051}
     3052
     3053static bool serial_number_greater(uint32_t s1, uint32_t s2)
     3054{
     3055    return (s1 < s2 && s2 - s1 > 0x80000000) || (s1 > s2 && s1 - s2 < 0x80000000);
    30373056}
    30383057
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