Changeset 83028 in vbox
- Timestamp:
- Feb 9, 2020 10:05:09 PM (5 years ago)
- Location:
- trunk/src/VBox/Devices
- Files:
-
- 2 edited
-
Network/DevVirtioNet_1_0.cpp (modified) (77 diffs)
-
VirtIO/Virtio_1_0.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/DevVirtioNet_1_0.cpp
r82968 r83028 59 59 #include "VBoxDD.h" 60 60 61 /** @todo FIX UP THESE HACKS AFTER DEBUGGING */ 62 63 /* After debugging single instance case, restore instance name logging */ 64 #define INSTANCE(pState) (char *)(pState->szInstanceName ? "" : "") // Avoid requiring RT_NOREF in some funcs 65 66 61 67 #define VIRTIONET_SAVED_STATE_VERSION UINT32_C(1) 62 68 #define VIRTIONET_MAX_QPAIRS 1 … … 67 73 #define VIRTIONET_PREALLOCATE_RX_SEG_COUNT 32 68 74 69 #define INSTANCE(pState) pState->szInstanceName 75 70 76 #define QUEUE_NAME(a_pVirtio, a_idxQueue) ((a_pVirtio)->virtqState[(a_idxQueue)].szVirtqName) 71 77 #define VIRTQNAME(idxQueue) (pThis->aszVirtqNames[idxQueue]) … … 471 477 472 478 } VIRTIONETR3; 479 480 473 481 /** Pointer to the ring-3 state of the VirtIO Host NET device. */ 474 482 typedef VIRTIONETR3 *PVIRTIONETR3; … … 513 521 static DECLCALLBACK(int) virtioNetR3WakeupWorker(PPDMDEVINS pDevIns, PPDMTHREAD pThread) 514 522 { 515 LogFunc(("\n"));516 523 PVIRTIONET pThis = PDMDEVINS_2_DATA(pDevIns, PVIRTIONET); 524 LogFunc(("%s\n", INSTANCE(pThis))); 517 525 return PDMDevHlpSUPSemEventSignal(pDevIns, pThis->aWorkers[(uintptr_t)pThread->pvUser].hEvtProcess); 518 526 } … … 612 620 DECLINLINE(bool) virtioNetValidateRequiredFeatures(uint32_t fFeatures) 613 621 { 614 LogFunc(("\n"));615 622 uint32_t fGuestChksumRequired = fFeatures & VIRTIONET_F_GUEST_TSO4 616 623 || fFeatures & VIRTIONET_F_GUEST_TSO6 … … 694 701 uint32_t offIntra = offConfig - RT_UOFFSETOF(VIRTIONET_CONFIG_T, member); \ 695 702 if (fWrite) \ 696 LogFunc((" Guest attempted to write readonly virtio_pci_common_cfg.%s\n", #member)); \703 LogFunc(("%s Guest attempted to write readonly virtio_pci_common_cfg.%s\n", INSTANCE(pThis), #member)); \ 697 704 else \ 698 705 { \ … … 721 728 else 722 729 { 723 LogFunc((" Bad access by guest to virtio_net_config: off=%u (%#x), cb=%u\n", offConfig, offConfig, cb));730 LogFunc(("%s Bad access by guest to virtio_net_config: off=%u (%#x), cb=%u\n", INSTANCE(pThis), offConfig, offConfig, cb)); 724 731 return fWrite ? VINF_SUCCESS : VINF_IOM_MMIO_UNUSED_00; 725 732 } … … 739 746 PVIRTIONET pThis = PDMDEVINS_2_DATA(pDevIns, PVIRTIONET); 740 747 741 LogFunc(("%s :uOffset: %d, cb: %d\n", INSTANCE(pThis), uOffset, cb));748 LogFunc(("%s uOffset: %d, cb: %d\n", INSTANCE(pThis), uOffset, cb)); 742 749 return virtioNetR3CfgAccessed(PDMDEVINS_2_DATA(pDevIns, PVIRTIONET), uOffset, pv, cb, false /*fRead*/); 743 750 } … … 750 757 PVIRTIONET pThis = PDMDEVINS_2_DATA(pDevIns, PVIRTIONET); 751 758 752 LogFunc(("%s :uOffset: %d, cb: %d: %.*Rhxs\n", INSTANCE(pThis), uOffset, cb, RT_MAX(cb, 8) , pv));759 LogFunc(("%s uOffset: %d, cb: %d: %.*Rhxs\n", INSTANCE(pThis), uOffset, cb, RT_MAX(cb, 8) , pv)); 753 760 return virtioNetR3CfgAccessed(PDMDEVINS_2_DATA(pDevIns, PVIRTIONET), uOffset, (void *)pv, cb, true /*fWrite*/); 754 761 } … … 790 797 791 798 RT_NOREF(pThisCC); 792 LogFunc((" LOAD EXEC!!\n"));799 LogFunc(("%s LOAD EXEC!!\n", INSTANCE(pThis))); 793 800 794 801 AssertReturn(uPass == SSM_PASS_FINAL, VERR_SSM_UNEXPECTED_PASS); … … 813 820 if (pThis->afQueueAttached[idxQueue]) 814 821 { 815 LogFunc((" Waking %s worker.\n", VIRTQNAME(idxQueue)));822 LogFunc(("%s Waking %s worker.\n", INSTANCE(pThis), VIRTQNAME(idxQueue))); 816 823 rc = PDMDevHlpSUPSemEventSignal(pDevIns, pThis->aWorkers[idxQueue].hEvtProcess); 817 824 AssertRCReturn(rc, rc); … … 832 839 RT_NOREF(pThisCC); 833 840 834 LogFunc((" SAVE EXEC!!\n"));841 LogFunc(("%s SAVE EXEC!!\n", INSTANCE(pThis))); 835 842 836 843 for (int idxQueue = 0; idxQueue < pThis->cVirtQueues; idxQueue++) … … 858 865 /** @todo create test to conclusively determine I/O has been quiesced and add it here: */ 859 866 860 LogFunc((" Device I/O activity quiesced: %s\n",861 virtioCoreGetStateChangeText(pThisCC->enmQuiescingFor)));867 LogFunc(("%s Device I/O activity quiesced: %s\n", 868 INSTANCE(pThis), virtioCoreGetStateChangeText(pThisCC->enmQuiescingFor))); 862 869 863 870 virtioCoreR3VmStateChanged(&pThis->Virtio, pThisCC->enmQuiescingFor); … … 904 911 { 905 912 PVIRTIONET pThis = PDMDEVINS_2_DATA(pDevIns, PVIRTIONET); 906 LogFunc((" \n"));913 LogFunc(("%s\n", INSTANCE(pThis))); 907 914 pThis->fResetting = true; 908 915 virtioNetR3QuiesceDevice(pDevIns, kvirtIoVmStateChangedReset); … … 914 921 static DECLCALLBACK(void) virtioNetR3SuspendOrPowerOff(PPDMDEVINS pDevIns, VIRTIOVMSTATECHANGED enmType) 915 922 { 916 LogFunc(("\n"));917 923 918 924 PVIRTIONET pThis = PDMDEVINS_2_DATA(pDevIns, PVIRTIONET); 919 925 PVIRTIONETCC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PVIRTIONETCC); 926 LogFunc(("%s\n", INSTANCE(pThis))); 920 927 921 928 RT_NOREF2(pThis, pThisCC); … … 929 936 static DECLCALLBACK(void) virtioNetR3PowerOff(PPDMDEVINS pDevIns) 930 937 { 931 LogFunc(("\n")); 938 PVIRTIONET pThis = PDMDEVINS_2_DATA(pDevIns, PVIRTIONET); 939 LogFunc(("%s\n", INSTANCE(pThis))); 940 932 941 virtioNetR3SuspendOrPowerOff(pDevIns, kvirtIoVmStateChangedPowerOff); 933 942 } … … 938 947 static DECLCALLBACK(void) virtioNetR3Suspend(PPDMDEVINS pDevIns) 939 948 { 940 LogFunc(("\n")); 949 PVIRTIONET pThis = PDMDEVINS_2_DATA(pDevIns, PVIRTIONET); 950 LogFunc(("%s \n", INSTANCE(pThis))); 941 951 virtioNetR3SuspendOrPowerOff(pDevIns, kvirtIoVmStateChangedSuspend); 942 952 } … … 965 975 if (ASMAtomicReadBool(&pThisCC->aWorkers[idxQueue].fSleeping)) 966 976 { 967 Log6Func((" waking %s worker.\n", VIRTQNAME(idxQueue)));977 Log6Func(("%s waking %s worker.\n", INSTANCE(pThis), VIRTQNAME(idxQueue))); 968 978 int rc = PDMDevHlpSUPSemEventSignal(pDevIns, pThis->aWorkers[idxQueue].hEvtProcess); 969 979 AssertRC(rc); … … 1048 1058 int rc; 1049 1059 1050 LogF lowFunc(("%s: idxQueue = %d\n", INSTANCE(pThis), idxQueue));1060 LogFunc(("%s %s\n", INSTANCE(pThis), VIRTQNAME(idxQueue))); 1051 1061 1052 1062 if (!pThis->fVirtioReady) … … 1067 1077 } 1068 1078 1069 LogFlowFunc(("%s :idxQueue = %d -> %Rrc\n", INSTANCE(pThis), idxQueue, rc));1079 LogFlowFunc(("%s idxQueue = %d -> %Rrc\n", INSTANCE(pThis), idxQueue, rc)); 1070 1080 return rc; 1071 1081 } … … 1100 1110 if (!virtioNetAllSystemsGo(pThis, pDevIns)) 1101 1111 { 1102 LogFunc((" VirtIO not ready\n"));1112 LogFunc(("%s VirtIO not ready\n", INSTANCE(pThis))); 1103 1113 return VERR_NET_NO_BUFFER_SPACE; 1104 1114 } … … 1107 1117 return VERR_NET_NO_BUFFER_SPACE; 1108 1118 1109 LogFlowFunc(("%s :timeoutMs=%u\n", INSTANCE(pThis), timeoutMs));1119 LogFlowFunc(("%s timeoutMs=%u\n", INSTANCE(pThis), timeoutMs)); 1110 1120 1111 1121 ASMAtomicXchgBool(&pThis->fLeafWantsRxBuffers, true); … … 1121 1131 if (RT_SUCCESS(virtioNetR3IsRxQueuePrimed(pDevIns, pThis, idxQueue))) 1122 1132 { 1123 LogFunc((" Rx bufs now available, releasing waiter..."));1133 LogFunc(("%s Rx bufs now available, releasing waiter...", INSTANCE(pThis))); 1124 1134 return VINF_SUCCESS; 1125 1135 } 1126 1136 } 1127 LogFunc(("%s :Starved for guest Rx bufs, waiting %u ms ...\n",1137 LogFunc(("%s Starved for guest Rx bufs, waiting %u ms ...\n", 1128 1138 INSTANCE(pThis), timeoutMs)); 1129 1139 … … 1141 1151 ASMAtomicXchgBool(&pThis->fLeafWantsRxBuffers, false); 1142 1152 1143 LogFlowFunc(("%s :Wait for Rx buffers available was interrupted\n", INSTANCE(pThis)));1153 LogFlowFunc(("%s Wait for Rx buffers available was interrupted\n", INSTANCE(pThis))); 1144 1154 return VERR_INTERRUPTED; 1145 1155 } … … 1236 1246 static bool virtioNetR3AddressFilter(PVIRTIONET pThis, const void *pvBuf, size_t cb) 1237 1247 { 1238 LogFunc((" \n"));1248 LogFunc(("%s\n", INSTANCE(pThis))); 1239 1249 1240 1250 if (pThis->fPromiscuous) … … 1248 1258 && !ASMBitTest(pThis->aVlanFilter, RT_BE2H_U16(uPtr[7]) & 0xFFF)) 1249 1259 { 1250 Log4Func(("%s :not our VLAN, returning false\n", INSTANCE(pThis)));1260 Log4Func(("%s not our VLAN, returning false\n", INSTANCE(pThis))); 1251 1261 return false; 1252 1262 } … … 1274 1284 return true; 1275 1285 1276 Log2Func(("%s :failed all tests, returning false, packet dump follows:\n",1286 Log2Func(("%s failed all tests, returning false, packet dump follows:\n", 1277 1287 INSTANCE(pThis))); 1278 1288 … … 1302 1312 RT_NOREF(pThisCC); 1303 1313 1304 LogFunc((" \n"));1314 LogFunc(("%s\n", INSTANCE(pThis))); 1305 1315 VIRTIONET_PKT_HDR_T rxPktHdr; 1306 1316 … … 1449 1459 PVIRTIONET pThis = PDMDEVINS_2_DATA(pDevIns, PVIRTIONET); 1450 1460 1451 LogFunc((" \n"));1461 LogFunc(("%s\n", pThis)); 1452 1462 1453 1463 if (!pThis->fVirtioReady) … … 1525 1535 1526 1536 /* Read physical bytes from the out segment(s) of descriptor chain */ 1527 static void virtioNetR3PullChain(PPDMDEVINS pDevIns, PVIRTIO _DESC_CHAIN_T pDescChain, void *pv, uint16_t cb)1537 static void virtioNetR3PullChain(PPDMDEVINS pDevIns, PVIRTIONET pThis, PVIRTIO_DESC_CHAIN_T pDescChain, void *pv, uint16_t cb) 1528 1538 { 1529 1539 uint8_t *pb = (uint8_t *)pv; … … 1538 1548 pDescChain->cbPhysSend -= cbSeg; 1539 1549 } 1540 LogFunc((" Pulled %d / %d bytes from desc chain (%d bytes left in desc chain)\n",1541 cb - cbLim, cb, pDescChain->cbPhysSend));1550 LogFunc(("%s Pulled %d/%d bytes from desc chain (%d bytes left)\n", 1551 INSTANCE(pThis), cb - cbLim, cb, pDescChain->cbPhysSend)); 1542 1552 } 1543 1553 … … 1546 1556 { 1547 1557 1548 #define LOG_VIRTIONET_FLAG(fld) LogFunc(("%s = %d\n", #fld, pThis->fld))1549 1550 LogFunc((" Processing CTRL Rx command\n"));1558 #define LOG_VIRTIONET_FLAG(fld) LogFunc(("%s Setting %s=%d\n", INSTANCE(pThis), #fld, pThis->fld)) 1559 1560 LogFunc(("%s Processing CTRL Rx command\n", INSTANCE(pThis))); 1551 1561 switch(pCtrlPktHdr->uCmd) 1552 1562 { … … 1569 1579 1570 1580 uint8_t fOn, fPromiscChanged = false; 1571 virtioNetR3PullChain(pDevIns, p DescChain, &fOn, RT_MIN(pDescChain->cbPhysSend, sizeof(fOn)));1581 virtioNetR3PullChain(pDevIns, pThis, pDescChain, &fOn, RT_MIN(pDescChain->cbPhysSend, sizeof(fOn))); 1572 1582 1573 1583 switch(pCtrlPktHdr->uCmd) … … 1604 1614 { 1605 1615 uint8_t fPromiscuous = pThis->fPromiscuous | pThis->fAllMulticast; 1606 LogFunc(("Setting promiscuous state to %d\n", fPromiscuous));1607 1616 pThisCC->pDrv->pfnSetPromiscuousMode(pThisCC->pDrv, fPromiscuous); 1608 1617 } … … 1614 1623 PVIRTIONET_CTRL_HDR_T pCtrlPktHdr, PVIRTIO_DESC_CHAIN_T pDescChain) 1615 1624 { 1616 LogFunc((" Processing CTRL MAC command\n"));1625 LogFunc(("%s Processing CTRL MAC command\n", INSTANCE(pThis))); 1617 1626 1618 1627 RT_NOREF(pThisCC); … … 1629 1638 1630 1639 size_t cbRemaining = pDescChain->cbPhysSend; 1631 Log6Func(("initial:cbRemaining=%d pDescChain->cbPhysSend=%d sizeof(*pCtrlPktHdr)=%d\n",1632 cbRemaining, pDescChain->cbPhysSend, sizeof(*pCtrlPktHdr)));1633 1640 switch(pCtrlPktHdr->uCmd) 1634 1641 { … … 1637 1644 /* Set default Rx filter MAC */ 1638 1645 ASSERT_CTRL_ADDR_SET(cbRemaining >= sizeof(VIRTIONET_CTRL_MAC_TABLE_LEN)); 1639 virtioNetR3PullChain(pDevIns, p DescChain, &pThis->rxFilterMacDefault, sizeof(VIRTIONET_CTRL_MAC_TABLE_LEN));1646 virtioNetR3PullChain(pDevIns, pThis, pDescChain, &pThis->rxFilterMacDefault, sizeof(VIRTIONET_CTRL_MAC_TABLE_LEN)); 1640 1647 break; 1641 1648 } … … 1646 1653 /* Load unicast MAC filter table */ 1647 1654 ASSERT_CTRL_TABLE_SET(cbRemaining >= sizeof(cMacs)); 1648 virtioNetR3PullChain(pDevIns, p DescChain, &cMacs, sizeof(cMacs));1655 virtioNetR3PullChain(pDevIns, pThis, pDescChain, &cMacs, sizeof(cMacs)); 1649 1656 cbRemaining -= sizeof(cMacs); 1650 Log6Func((" Guest provided %d unicast MAC Table entries\n", cMacs));1657 Log6Func(("%s Guest provided %d unicast MAC Table entries\n", INSTANCE(pThis), cMacs)); 1651 1658 if (cMacs) 1652 1659 { 1653 1660 uint32_t cbMacs = cMacs * sizeof(RTMAC); 1654 1661 ASSERT_CTRL_TABLE_SET(cbRemaining >= cbMacs); 1655 virtioNetR3PullChain(pDevIns, p DescChain, &pThis->aMacUnicastFilter, cbMacs);1662 virtioNetR3PullChain(pDevIns, pThis, pDescChain, &pThis->aMacUnicastFilter, cbMacs); 1656 1663 cbRemaining -= cbMacs; 1657 1664 } … … 1660 1667 /* Load multicast MAC filter table */ 1661 1668 ASSERT_CTRL_TABLE_SET(cbRemaining >= sizeof(cMacs)); 1662 virtioNetR3PullChain(pDevIns, p DescChain, &cMacs, sizeof(cMacs));1669 virtioNetR3PullChain(pDevIns, pThis, pDescChain, &cMacs, sizeof(cMacs)); 1663 1670 cbRemaining -= sizeof(cMacs); 1664 Log6Func((" Guest provided %d multicast MAC Table entries\n", cMacs));1671 Log6Func(("%s Guest provided %d multicast MAC Table entries\n", INSTANCE(pThis), cMacs)); 1665 1672 if (cMacs) 1666 1673 { 1667 1674 uint32_t cbMacs = cMacs * sizeof(RTMAC); 1668 1675 ASSERT_CTRL_TABLE_SET(cbRemaining >= cbMacs); 1669 virtioNetR3PullChain(pDevIns, p DescChain, &pThis->aMacMulticastFilter, cbMacs);1676 virtioNetR3PullChain(pDevIns, pThis, pDescChain, &pThis->aMacMulticastFilter, cbMacs); 1670 1677 cbRemaining -= cbMacs; 1671 1678 } … … 1673 1680 1674 1681 #ifdef LOG_ENABLED 1675 LogFunc(("%s :unicast MACs:\n", INSTANCE(pThis)));1682 LogFunc(("%s unicast MACs:\n", INSTANCE(pThis))); 1676 1683 for(unsigned i = 0; i < cMacs; i++) 1677 1684 LogFunc((" %RTmac\n", &pThis->aMacUnicastFilter[i])); 1678 1685 1679 LogFunc(("%s :multicast MACs:\n", INSTANCE(pThis)));1686 LogFunc(("%s multicast MACs:\n", INSTANCE(pThis))); 1680 1687 for(unsigned i = 0; i < cMacs; i++) 1681 LogFunc((" %RTmac\n", &pThis->aMac UnicastFilter[i]));1688 LogFunc((" %RTmac\n", &pThis->aMacMulticastFilter[i])); 1682 1689 #endif 1683 1690 … … 1690 1697 PVIRTIONET_CTRL_HDR_T pCtrlPktHdr, PVIRTIO_DESC_CHAIN_T pDescChain) 1691 1698 { 1692 LogFunc((" Processing CTRL VLAN command\n"));1699 LogFunc(("%s Processing CTRL VLAN command\n", INSTANCE(pThis))); 1693 1700 1694 1701 RT_NOREF(pThisCC); … … 1698 1705 AssertMsgReturn(cbRemaining > sizeof(uVlanId), 1699 1706 ("DESC chain too small for VIRTIO_NET_CTRL_VLAN cmd processing"), VIRTIONET_ERROR); 1700 virtioNetR3PullChain(pDevIns, p DescChain, &uVlanId, sizeof(uVlanId));1707 virtioNetR3PullChain(pDevIns, pThis, pDescChain, &uVlanId, sizeof(uVlanId)); 1701 1708 AssertMsgReturn(uVlanId > VIRTIONET_MAX_VLAN_ID, 1702 1709 ("%s VLAN ID out of range (VLAN ID=%u)\n", INSTANCE(pThis), uVlanId), VIRTIONET_ERROR); 1703 LogFunc(("%s :uCommand=%u VLAN ID=%u\n", INSTANCE(pThis), pCtrlPktHdr->uCmd, uVlanId));1710 LogFunc(("%s uCommand=%u VLAN ID=%u\n", INSTANCE(pThis), pCtrlPktHdr->uCmd, uVlanId)); 1704 1711 switch (pCtrlPktHdr->uCmd) 1705 1712 { … … 1719 1726 PVIRTIO_DESC_CHAIN_T pDescChain) 1720 1727 { 1721 LogFunc((" Received CTRL packet from guest\n"));1728 LogFunc(("%s Received CTRL packet from guest\n", INSTANCE(pThis))); 1722 1729 1723 1730 if (pDescChain->cbPhysSend < 2) 1724 1731 { 1725 LogFunc((" ctrl packet from guest driver incomplete. Skipping ctrl cmd\n"));1732 LogFunc(("%s CTRL packet from guest driver incomplete. Skipping ctrl cmd\n", INSTANCE(pThis))); 1726 1733 return; 1727 1734 } 1728 1735 else if (pDescChain->cbPhysReturn < sizeof(VIRTIONET_CTRL_HDR_T_ACK)) 1729 1736 { 1730 LogFunc((" Guest driver didn't allocate memory to receive ctrl pkt ACK. Skipping ctrl cmd\n"));1737 LogFunc(("%s Guest driver didn't allocate memory to receive ctrl pkt ACK. Skipping ctrl cmd\n", INSTANCE(pThis))); 1731 1738 return; 1732 1739 } … … 1742 1749 ("DESC chain too small for CTRL pkt header")); 1743 1750 1744 virtioNetR3PullChain(pDevIns, p DescChain, pCtrlPktHdr,1751 virtioNetR3PullChain(pDevIns, pThis, pDescChain, pCtrlPktHdr, 1745 1752 RT_MIN(pDescChain->cbPhysSend, sizeof(VIRTIONET_CTRL_HDR_T))); 1746 1753 1747 Log6Func((" CTRL pkt hdr: class=%d cmd=%d\n", pCtrlPktHdr->uClass, pCtrlPktHdr->uCmd));1754 Log6Func(("%s CTRL COMMAND: class=%d command=%d\n", INSTANCE(pThis), pCtrlPktHdr->uClass, pCtrlPktHdr->uCmd)); 1748 1755 1749 1756 uint8_t uAck; … … 1763 1770 if (FEATURE_DISABLED(STATUS) || FEATURE_DISABLED(GUEST_ANNOUNCE)) 1764 1771 { 1765 LogFunc((" Ignoring CTRL class VIRTIONET_CTRL_ANNOUNCE. Not configured to handle it\n"));1772 LogFunc(("%s Ignoring CTRL class VIRTIONET_CTRL_ANNOUNCE. Not configured to handle it\n", INSTANCE(pThis))); 1766 1773 virtioNetPrintFeatures(pThis, pThis->fNegotiatedFeatures, "Features"); 1767 1774 break; … … 1769 1776 if (pCtrlPktHdr->uCmd != VIRTIONET_CTRL_ANNOUNCE_ACK) 1770 1777 { 1771 LogFunc((" Ignoring CTRL class VIRTIONET_CTRL_ANNOUNCE. Unrecognized uCmd\n"));1778 LogFunc(("%s Ignoring CTRL class VIRTIONET_CTRL_ANNOUNCE. Unrecognized uCmd\n", INSTANCE(pThis))); 1772 1779 break; 1773 1780 } 1774 1781 pThis->virtioNetConfig.uStatus &= ~VIRTIONET_F_ANNOUNCE; 1775 Log6Func((" Clearing VIRTIONET_F_ANNOUNCE in config status\n"));1782 Log6Func(("%s Clearing VIRTIONET_F_ANNOUNCE in config status\n", INSTANCE(pThis))); 1776 1783 break; 1777 1784 … … 1815 1822 RTMemFree(pReturnSegBuf); 1816 1823 1817 LogFunc((" Processed ctrl message class/cmd = %u/%u. Ack=%u.\n",1818 pCtrlPktHdr->uClass, pCtrlPktHdr->uCmd, uAck));1824 LogFunc(("%s Finished processing CTRL command with status %s\n", 1825 INSTANCE(pThis), uAck == VIRTIONET_OK ? "VIRTIONET_OK" : "VIRTIONET_ERROR")); 1819 1826 1820 1827 } … … 1876 1883 //if (pGso->cbHdrs < pPktHdr->uCSumStart + pPktHdr->uCSumOffset + 2) 1877 1884 { 1878 Log4Func(("%s :HdrLen before adjustment %d.\n",1885 Log4Func(("%s HdrLen before adjustment %d.\n", 1879 1886 INSTANCE(pThis), pGso->cbHdrsTotal)); 1880 1887 switch (pGso->u8Type) … … 1894 1901 ((PPDMNETWORKGSO)pSgBuf->pvUser)->cbHdrsTotal = pGso->cbHdrsTotal; 1895 1902 ((PPDMNETWORKGSO)pSgBuf->pvUser)->cbHdrsSeg = pGso->cbHdrsSeg; 1896 Log4Func(("%s :adjusted HdrLen to %d.\n",1903 Log4Func(("%s adjusted HdrLen to %d.\n", 1897 1904 INSTANCE(pThis), pGso->cbHdrsTotal)); 1898 1905 } 1899 Log2Func(("%s :gso type=%x cbHdrsTotal=%u cbHdrsSeg=%u mss=%u off1=0x%x off2=0x%x\n",1906 Log2Func(("%s gso type=%x cbHdrsTotal=%u cbHdrsSeg=%u mss=%u off1=0x%x off2=0x%x\n", 1900 1907 INSTANCE(pThis), pGso->u8Type, pGso->cbHdrsTotal, pGso->cbHdrsSeg, 1901 1908 pGso->cbMaxSeg, pGso->offHdr1, pGso->offHdr2)); … … 1928 1935 if (!pThis->fVirtioReady) 1929 1936 { 1930 LogFunc(("%s Ignoring transmitrequests. VirtIO not ready (status=0x%x).\n",1937 LogFunc(("%s Ignoring Tx requests. VirtIO not ready (status=0x%x).\n", 1931 1938 INSTANCE(pThis), pThis->virtioNetConfig.uStatus)); 1932 1939 return; … … 1953 1960 unsigned int cbPktHdr = sizeof(VIRTIONET_PKT_HDR_T); 1954 1961 1955 Log3Func(("%s :About to transmit %d pending packets\n", INSTANCE(pThis),1962 Log3Func(("%s About to transmit %d pending packets\n", INSTANCE(pThis), 1956 1963 virtioCoreR3QueuePendingCount(pVirtio->pDevIns, pVirtio, idxQueue))); 1957 1964 … … 1963 1970 { 1964 1971 if (RT_SUCCESS(rc)) 1965 Log6Func((" fetched descriptor chain from %s\n", VIRTQNAME(idxQueue)));1972 Log6Func(("%s fetched descriptor chain from %s\n", INSTANCE(pThis), VIRTQNAME(idxQueue))); 1966 1973 else 1967 1974 { 1968 LogFunc((" Failed find expected data on %s, rc = %Rrc\n", VIRTQNAME(idxQueue), rc));1975 LogFunc(("%s Failed find expected data on %s, rc = %Rrc\n", INSTANCE(pThis), VIRTQNAME(idxQueue), rc)); 1969 1976 break; 1970 1977 } … … 1977 1984 /* This check could be made more complex, because in theory (but not likely nor 1978 1985 * seen in practice) the first segment could contain header and data. */ 1979 LogFunc(("%s :The first segment is not the header! (%u < 2 || %u != %u).\n",1986 LogFunc(("%s The first segment is not the header! (%u < 2 || %u != %u).\n", 1980 1987 INSTANCE(pThis), cSegsFromGuest, paSegsFromGuest[0].cbSeg, cbPktHdr)); 1981 1988 break; … … 1989 1996 uSize += paSegsFromGuest[i].cbSeg; 1990 1997 1991 Log5Func(("%s :complete frame is %u bytes.\n", INSTANCE(pThis), uSize));1998 Log5Func(("%s complete frame is %u bytes.\n", INSTANCE(pThis), uSize)); 1992 1999 Assert(uSize <= VIRTIONET_MAX_FRAME_SIZE); 1993 2000 … … 2022 2029 if (RT_FAILURE(rc)) 2023 2030 { 2024 LogFunc((" Failed to transmit frame, rc = %Rrc\n", rc));2031 LogFunc(("%s Failed to transmit frame, rc = %Rrc\n", INSTANCE(pThis), rc)); 2025 2032 pThisCC->pDrv->pfnFreeBuf(pThisCC->pDrv, pSgBufToPdmLeafDevice); 2026 2033 } … … 2081 2088 #endif 2082 2089 2083 Log6Func(("%s has available buffers\n", VIRTQNAME(idxQueue)));2090 Log6Func(("%s %s has available buffers\n", INSTANCE(pThis), VIRTQNAME(idxQueue))); 2084 2091 2085 2092 if (IS_RX_QUEUE(idxQueue)) 2086 2093 { 2087 LogFunc(("%s Receive buffers ha s been added, waking up receivethread.\n",2094 LogFunc(("%s Receive buffers have been added, waking Rx thread.\n", 2088 2095 INSTANCE(pThis))); 2089 2096 virtioNetR3WakeupRxBufWaiter(pDevIns); … … 2096 2103 if (ASMAtomicReadBool(&pWorkerR3->fSleeping)) 2097 2104 { 2098 Log6Func((" waking %s worker.\n", VIRTQNAME(idxQueue)));2105 Log6Func(("%s waking %s worker.\n", INSTANCE(pThis), VIRTQNAME(idxQueue))); 2099 2106 int rc = PDMDevHlpSUPSemEventSignal(pDevIns, pWorker->hEvtProcess); 2100 2107 AssertRC(rc); … … 2118 2125 return VINF_SUCCESS; 2119 2126 } 2120 LogFunc(("%s \n", VIRTQNAME(idxQueue)));2127 LogFunc(("%s %s\n", INSTANCE(pThis), VIRTQNAME(idxQueue))); 2121 2128 while (pThread->enmState == PDMTHREADSTATE_RUNNING) 2122 2129 { … … 2130 2137 if (!fNotificationSent) 2131 2138 { 2132 Log6Func(("%s worker sleeping...\n", VIRTQNAME(idxQueue)));2139 Log6Func(("%s %s worker sleeping...\n", INSTANCE(pThis), VIRTQNAME(idxQueue))); 2133 2140 Assert(ASMAtomicReadBool(&pWorkerR3->fSleeping)); 2134 2141 int rc = PDMDevHlpSUPSemEventWaitNoResume(pDevIns, pWorker->hEvtProcess, RT_INDEFINITE_WAIT); … … 2141 2148 continue; 2142 2149 } 2143 Log6Func(("%s worker woken\n", VIRTQNAME(idxQueue)));2150 Log6Func(("%s %s worker woken\n", INSTANCE(pThis), VIRTQNAME(idxQueue))); 2144 2151 ASMAtomicWriteBool(&pWorkerR3->fNotified, false); 2145 2152 } … … 2154 2161 if (IS_CTRL_QUEUE(idxQueue)) 2155 2162 { 2156 Log6Func((" fetching next descriptor chain from %s\n", VIRTQNAME(idxQueue)));2163 Log6Func(("%s fetching next descriptor chain from %s\n", INSTANCE(pThis), VIRTQNAME(idxQueue))); 2157 2164 PVIRTIO_DESC_CHAIN_T pDescChain; 2158 2165 int rc = virtioCoreR3QueueGet(pDevIns, &pThis->Virtio, idxQueue, &pDescChain, true); 2159 2166 if (rc == VERR_NOT_AVAILABLE) 2160 2167 { 2161 Log6Func((" Nothing found in %s\n", VIRTQNAME(idxQueue)));2168 Log6Func(("%s Nothing found in %s\n", INSTANCE(pThis), VIRTQNAME(idxQueue))); 2162 2169 continue; 2163 2170 } … … 2166 2173 else if (IS_TX_QUEUE(idxQueue)) 2167 2174 { 2168 Log6Func((" Notified of data to transmit\n"));2175 Log6Func(("%s Notified of data to transmit\n", INSTANCE(pThis))); 2169 2176 virtioNetR3TransmitPendingPackets(pDevIns, pThis, pThisCC, 2170 2177 idxQueue, true /* fOnWorkerThread */); … … 2184 2191 RT_NOREF(pDevIns, pThis, rcBusy); 2185 2192 /* Original DevVirtioNet uses CS in attach/detach/link-up timer/tx timer/transmit */ 2186 LogFunc((" CS unimplemented. What does the critical section protect in orig driver??"));2193 LogFunc(("%s CS unimplemented. What does the critical section protect in orig driver??", INSTANCE(pThis))); 2187 2194 return VINF_SUCCESS; 2188 2195 } … … 2191 2198 { 2192 2199 RT_NOREF(pDevIns, pThis); 2193 LogFunc((" CS unimplemented. What does the critical section protect in orig driver??"));2200 LogFunc(("%s CS unimplemented. What does the critical section protect in orig driver??", INSTANCE(pThis))); 2194 2201 } 2195 2202 … … 2213 2220 virtioNetR3CsLeave(pDevIns, pThis); 2214 2221 2215 LogFunc(("%s :Link is up\n", INSTANCE(pThis)));2222 LogFunc(("%s Link is up\n", INSTANCE(pThis))); 2216 2223 2217 2224 if (pThisCC->pDrv) … … 2242 2249 AssertRC(rc); 2243 2250 2244 LogFunc(("%s :Link is down temporarily\n", INSTANCE(pThis)));2251 LogFunc(("%s Link is down temporarily\n", INSTANCE(pThis))); 2245 2252 } 2246 2253 } … … 2269 2276 bool fActiveLinkIsUp = (enmState == PDMNETWORKLINKSTATE_UP); 2270 2277 2271 LogFunc(("%s :enmState=%d\n", INSTANCE(pThis), enmState));2278 LogFunc(("%s enmState=%d\n", INSTANCE(pThis), enmState)); 2272 2279 if (enmState == PDMNETWORKLINKSTATE_DOWN_RESUME) 2273 2280 { … … 2309 2316 static int virtioNetR3DestroyWorkerThreads(PPDMDEVINS pDevIns, PVIRTIONET pThis, PVIRTIONETCC pThisCC) 2310 2317 { 2311 LogFunc((" \n"));2318 LogFunc(("%s\n", INSTANCE(pThis))); 2312 2319 int rc = VINF_SUCCESS; 2313 2320 for (unsigned idxQueue = 0; idxQueue < pThis->cVirtQueues; idxQueue++) … … 2333 2340 static int virtioNetR3CreateWorkerThreads(PPDMDEVINS pDevIns, PVIRTIONET pThis, PVIRTIONETCC pThisCC) 2334 2341 { 2335 LogFunc((" \n"));2342 LogFunc(("%s\n", INSTANCE(pThis))); 2336 2343 2337 2344 int rc = VINF_SUCCESS; … … 2371 2378 PVIRTIONETCC pThisCC = RT_FROM_MEMBER(pVirtioCC, VIRTIONETCC, Virtio); 2372 2379 2373 LogFunc((" \n"));2380 LogFunc(("%s\n", INSTANCE(pThis))); 2374 2381 2375 2382 pThis->fVirtioReady = fVirtioReady; … … 2377 2384 if (fVirtioReady) 2378 2385 { 2379 LogFunc(("VirtIO ready\n-----------------------------------------------------------------------------------------\n")); 2386 LogFunc(("%s VirtIO ready\n-----------------------------------------------------------------------------------------\n", 2387 INSTANCE(pThis))); 2380 2388 2381 2389 pThis->fResetting = false; … … 2391 2399 else 2392 2400 { 2393 LogFunc((" VirtIO is resetting\n"));2401 LogFunc(("%s VirtIO is resetting\n", INSTANCE(pThis))); 2394 2402 2395 2403 pThis->virtioNetConfig.uStatus = pThis->fCableConnected ? VIRTIONET_F_LINK_UP : 0; … … 2431 2439 PVIRTIONETCC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PVIRTIONETCC); 2432 2440 2433 LogFunc((" \n"));2441 LogFunc(("%s\n", INSTANCE(pThis))); 2434 2442 AssertLogRelReturnVoid(iLUN == 0); 2435 2443 … … 2458 2466 RT_NOREF(fFlags); 2459 2467 2460 LogFunc(("%s", INSTANCE(pThis)));2468 LogFunc(("%s", INSTANCE(pThis))); 2461 2469 2462 2470 AssertLogRelReturn(iLUN == 0, VERR_PDM_NO_SUCH_LUN); … … 2550 2558 */ 2551 2559 LogFunc(("PDM device instance: %d\n", iInstance)); 2552 RTStrPrintf(INSTANCE(pThis), sizeof(INSTANCE(pThis)), "VIRTIONET%d", iInstance); 2560 2561 2562 RTStrPrintf(pThis->szInstanceName, sizeof(pThis->szInstanceName), "VIRTIONET", iInstance); 2563 2553 2564 pThisCC->pDevIns = pDevIns; 2554 2565 … … 2614 2625 /* Initialize the generic Virtio core: */ 2615 2626 pThisCC->Virtio.pfnStatusChanged = virtioNetR3StatusChanged; 2616 pThisCC->Virtio.pfnQueueNotified = virtioNetR3QueueNotified; 2627 pThisCC->Virtio.pfnQueueNotified = virtioNetR3QueueNotified 2628 ; 2617 2629 pThisCC->Virtio.pfnDevCapRead = virtioNetR3DevCapRead; 2618 2630 pThisCC->Virtio.pfnDevCapWrite = virtioNetR3DevCapWrite; … … 2736 2748 /* .uReserved0 = */ 0, 2737 2749 /* .szName = */ "virtio-net-1-dot-0", 2738 /* .fFlags = */ PDM_DEVREG_FLAGS_DEFAULT_BITS | PDM_DEVREG_FLAGS_NEW_STYLE //| PDM_DEVREG_FLAGS_RZ | PDM_DEVREG_FLAGS_NEW_STYLE2750 /* .fFlags = */ PDM_DEVREG_FLAGS_DEFAULT_BITS | PDM_DEVREG_FLAGS_NEW_STYLE //| PDM_DEVREG_FLAGS_RZ 2739 2751 | PDM_DEVREG_FLAGS_FIRST_SUSPEND_NOTIFICATION 2740 2752 | PDM_DEVREG_FLAGS_FIRST_POWEROFF_NOTIFICATION, -
trunk/src/VBox/Devices/VirtIO/Virtio_1_0.cpp
r82968 r83028 226 226 } 227 227 228 DECLINLINE(void) virtioWriteUsedFlags(PPDMDEVINS pDevIns, PVIRTIOCORE pVirtio, uint16_t idxQueue, uint 32_t fFlags)228 DECLINLINE(void) virtioWriteUsedFlags(PPDMDEVINS pDevIns, PVIRTIOCORE pVirtio, uint16_t idxQueue, uint16_t fFlags) 229 229 { 230 230 AssertMsg(pVirtio->uDeviceStatus & VIRTIO_STATUS_DRIVER_OK, ("Called with guest driver not ready\n")); … … 234 234 &fFlags, sizeof(fFlags)); 235 235 } 236 237 236 #endif 238 237
Note:
See TracChangeset
for help on using the changeset viewer.

