Changeset 30941 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Jul 20, 2010 6:40:06 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/ISCSIHDDCore.cpp
r30309 r30941 251 251 ISCSISTATE_IN_LOGOUT 252 252 } ISCSISTATE; 253 254 /** 255 * iSCSI PDU send flags (and maybe more in the future). */ 256 typedef enum ISCSIPDUFLAGS 257 { 258 /** No special flags */ 259 ISCSIPDU_DEFAULT = 0, 260 /** Do not attempt to re-attach to the target if the connection is lost */ 261 ISCSIPDU_NO_REATTACH = RT_BIT(1) 262 } ISCSIPDUFLAGS; 253 263 254 264 … … 490 500 /* iSCSI low-level functions (only to be used from the iSCSI high-level functions). */ 491 501 static uint32_t iscsiNewITT(PISCSIIMAGE pImage); 492 static int iscsiSendPDU(PISCSIIMAGE pImage, PISCSIREQ paReq, uint32_t cnReq );502 static int iscsiSendPDU(PISCSIIMAGE pImage, PISCSIREQ paReq, uint32_t cnReq, uint32_t uFlags); 493 503 static int iscsiRecvPDU(PISCSIIMAGE pImage, uint32_t itt, PISCSIRES paRes, uint32_t cnRes); 494 504 static int drvISCSIValidatePDU(PISCSIRES paRes, uint32_t cnRes); … … 626 636 pImage->pInterfaceNetCallbacks->pfnClientClose(pImage->Socket); 627 637 pImage->Socket = NIL_RTSOCKET; 638 pImage->state = ISCSISTATE_FREE; 628 639 rc = VERR_NET_CONNECTION_RESET; 629 640 break; … … 711 722 unsigned int i; 712 723 713 LogFlow (("iscsiTransportWrite:cnRequest=%d (%s:%d)\n", cnRequest, pImage->pszHostname, pImage->uPort));724 LogFlowFunc(("cnRequest=%d (%s:%d)\n", cnRequest, pImage->pszHostname, pImage->uPort)); 714 725 if (pImage->Socket == NIL_RTSOCKET) 715 726 { … … 766 777 } 767 778 768 LogFlow (("iscsiTransportWrite:returns %Rrc\n", rc));779 LogFlowFunc(("returns %Rrc\n", rc)); 769 780 return rc; 770 781 } … … 1085 1096 cnISCSIReq++; 1086 1097 1087 rc = iscsiSendPDU(pImage, aISCSIReq, cnISCSIReq );1098 rc = iscsiSendPDU(pImage, aISCSIReq, cnISCSIReq, ISCSIPDU_NO_REATTACH); 1088 1099 if (RT_SUCCESS(rc)) 1089 1100 { … … 1347 1358 ISCSIREQ aISCSIReq[4]; 1348 1359 uint32_t aReqBHS[12]; 1349 LogFlow (("iscsiDetach:entering\n"));1360 LogFlowFunc(("entering\n")); 1350 1361 1351 1362 RTSemMutexRequest(pImage->Mutex, RT_INDEFINITE_WAIT); … … 1377 1388 cnISCSIReq++; 1378 1389 1379 rc = iscsiSendPDU(pImage, aISCSIReq, cnISCSIReq );1390 rc = iscsiSendPDU(pImage, aISCSIReq, cnISCSIReq, ISCSIPDU_NO_REATTACH); 1380 1391 if (RT_SUCCESS(rc)) 1381 1392 { … … 1415 1426 RTSemMutexRelease(pImage->Mutex); 1416 1427 1417 LogFlow (("iscsiDetach:leaving\n"));1428 LogFlowFunc(("leaving\n")); 1418 1429 LogRel(("iSCSI: logout to target %s\n", pImage->pszTargetName)); 1419 1430 return VINF_SUCCESS; … … 1447 1458 bool final = false; 1448 1459 1449 LogFlow (("iscsiCommand:entering, CmdSN=%d\n", pImage->CmdSN));1460 LogFlowFunc(("entering, CmdSN=%d\n", pImage->CmdSN)); 1450 1461 1451 1462 Assert(pRequest->enmXfer != SCSIXFER_TO_FROM_TARGET); /**< @todo not yet supported, would require AHS. */ … … 1504 1515 } 1505 1516 1506 rc = iscsiSendPDU(pImage, aISCSIReq, cnISCSIReq );1517 rc = iscsiSendPDU(pImage, aISCSIReq, cnISCSIReq, ISCSIPDU_DEFAULT); 1507 1518 if (RT_FAILURE(rc)) 1508 1519 goto out_release; … … 1647 1658 1648 1659 out: 1649 LogFlow (("iscsiCommand:returns %Rrc\n", rc));1660 LogFlowFunc(("returns %Rrc\n", rc)); 1650 1661 return rc; 1651 1662 } … … 1677 1688 * @param paReq Pointer to array of iSCSI request sections. 1678 1689 * @param cnReq Number of valid iSCSI request sections in the array. 1690 * @param uFlags Flags controlling the exact send semantics. 1679 1691 */ 1680 static int iscsiSendPDU(PISCSIIMAGE pImage, PISCSIREQ paReq, uint32_t cnReq) 1692 static int iscsiSendPDU(PISCSIIMAGE pImage, PISCSIREQ paReq, uint32_t cnReq, 1693 uint32_t uFlags) 1681 1694 { 1682 1695 int rc = VINF_SUCCESS; … … 1684 1697 * needs cleaning up of timeout/disconnect handling a bit, as otherwise 1685 1698 * too many incorrect errors are signalled. */ 1686 Assert(pImage->paCurrReq == NULL);1687 1699 Assert(cnReq >= 1); 1688 1700 Assert(paReq[0].cbSeg >= ISCSI_BHS_SIZE); … … 1693 1705 if (RT_SUCCESS(rc)) 1694 1706 break; 1695 if (rc != VERR_BROKEN_PIPE && rc != VERR_NET_CONNECTION_REFUSED) 1707 if ( (uFlags & ISCSIPDU_NO_REATTACH) 1708 || (rc != VERR_BROKEN_PIPE && rc != VERR_NET_CONNECTION_REFUSED)) 1696 1709 break; 1697 1710 /* No point in reestablishing the connection for a logout */ … … 1754 1767 if (pImage->paCurrReq != NULL) 1755 1768 { 1756 rc = iscsiSendPDU(pImage, pImage->paCurrReq, pImage->cnCurrReq );1769 rc = iscsiSendPDU(pImage, pImage->paCurrReq, pImage->cnCurrReq, ISCSIPDU_DEFAULT); 1757 1770 if (RT_FAILURE(rc)) 1758 1771 break; … … 1874 1887 cnISCSIReq++; 1875 1888 1876 iscsiSendPDU(pImage, aISCSIReq, cnISCSIReq );1889 iscsiSendPDU(pImage, aISCSIReq, cnISCSIReq, ISCSIPDU_NO_REATTACH); 1877 1890 } 1878 1891 } … … 1964 1977 default: 1965 1978 /* Do some logging, ignore PDU. */ 1966 LogFlow (("drvISCSIValidatePDU:ignore unhandled PDU, first word %#08x\n", RT_N2H_U32(pcrgResBHS[0])));1979 LogFlowFunc(("ignore unhandled PDU, first word %#08x\n", RT_N2H_U32(pcrgResBHS[0]))); 1967 1980 return VERR_PARSE_ERROR; 1968 1981 }
Note:
See TracChangeset
for help on using the changeset viewer.