- Timestamp:
- Feb 25, 2020 1:54:08 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/DevVirtioNet_1_0.cpp
r83058 r83153 415 415 uint8_t aVlanFilter[VIRTIONET_MAX_VLAN_ID / sizeof(uint8_t)]; 416 416 417 bool fLog; 418 417 419 /* Receive-blocking-related fields ***************************************/ 418 420 … … 522 524 { 523 525 PVIRTIONET pThis = PDMDEVINS_2_DATA(pDevIns, PVIRTIONET); 524 Log Func(("%s\n", INSTANCE(pThis)));526 Log10Func(("%s\n", INSTANCE(pThis))); 525 527 return PDMDevHlpSUPSemEventSignal(pDevIns, pThis->aWorkers[(uintptr_t)pThread->pvUser].hEvtProcess); 526 528 } … … 535 537 AssertReturnVoid(pThis->hEventRxDescAvail != NIL_SUPSEMEVENT); 536 538 537 Log Func(("%s Waking downstream driver's Rx buf waiter thread\n", INSTANCE(pThis)));539 Log10Func(("%s Waking downstream driver's Rx buf waiter thread\n", INSTANCE(pThis))); 538 540 int rc = PDMDevHlpSUPSemEventSignal(pDevIns, pThis->hEventRxDescAvail); 539 541 AssertRC(rc); … … 560 562 DECLINLINE(void) virtioNetR3PacketDump(PVIRTIONET pThis, const uint8_t *pbPacket, size_t cb, const char *pszText) 561 563 { 562 # ifdef DEBUG 563 # if 0 564 Log(("%s %s packet #%d (%d bytes):\n", 565 INSTANCE(pThis), pszText, ++pThis->u32PktNo, cb)); 566 Log3(("%.*Rhxd\n", cb, pbPacket)); 567 # else 564 // if (!LogIs12Enabled()) 565 // return; 566 568 567 vboxEthPacketDump(INSTANCE(pThis), pszText, pbPacket, (uint32_t)cb); 569 # endif570 # else571 RT_NOREF4(pThis, pbPacket, cb, pszText);572 # endif573 568 } 574 569 … … 757 752 PVIRTIONET pThis = PDMDEVINS_2_DATA(pDevIns, PVIRTIONET); 758 753 759 Log Func(("%s uOffset: %d, cb: %d: %.*Rhxs\n", INSTANCE(pThis), uOffset, cb, RT_MAX(cb, 8) , pv));754 Log10Func(("%s uOffset: %d, cb: %d: %.*Rhxs\n", INSTANCE(pThis), uOffset, cb, RT_MAX(cb, 8) , pv)); 760 755 return virtioNetR3CfgAccessed(PDMDEVINS_2_DATA(pDevIns, PVIRTIONET), uOffset, (void *)pv, cb, true /*fWrite*/); 761 756 } … … 797 792 798 793 RT_NOREF(pThisCC); 799 Log Func(("%s LOAD EXEC!!\n", INSTANCE(pThis)));794 Log7Func(("%s LOAD EXEC!!\n", INSTANCE(pThis))); 800 795 801 796 AssertReturn(uPass == SSM_PASS_FINAL, VERR_SSM_UNEXPECTED_PASS); … … 820 815 if (pThis->afQueueAttached[idxQueue]) 821 816 { 822 Log Func(("%s Waking %s worker.\n", INSTANCE(pThis), VIRTQNAME(idxQueue)));817 Log7Func(("%s Waking %s worker.\n", INSTANCE(pThis), VIRTQNAME(idxQueue))); 823 818 rc = PDMDevHlpSUPSemEventSignal(pDevIns, pThis->aWorkers[idxQueue].hEvtProcess); 824 819 AssertRCReturn(rc, rc); … … 839 834 RT_NOREF(pThisCC); 840 835 841 Log Func(("%s SAVE EXEC!!\n", INSTANCE(pThis)));836 Log7Func(("%s SAVE EXEC!!\n", INSTANCE(pThis))); 842 837 843 838 for (int idxQueue = 0; idxQueue < pThis->cVirtQueues; idxQueue++) … … 865 860 /** @todo create test to conclusively determine I/O has been quiesced and add it here: */ 866 861 867 Log Func(("%s Device I/O activity quiesced: %s\n",862 Log7Func(("%s Device I/O activity quiesced: %s\n", 868 863 INSTANCE(pThis), virtioCoreGetStateChangeText(pThisCC->enmQuiescingFor))); 869 864 … … 911 906 { 912 907 PVIRTIONET pThis = PDMDEVINS_2_DATA(pDevIns, PVIRTIONET); 913 Log Func(("%s\n", INSTANCE(pThis)));908 Log7Func(("%s\n", INSTANCE(pThis))); 914 909 pThis->fResetting = true; 915 910 virtioNetR3QuiesceDevice(pDevIns, kvirtIoVmStateChangedReset); … … 924 919 PVIRTIONET pThis = PDMDEVINS_2_DATA(pDevIns, PVIRTIONET); 925 920 PVIRTIONETCC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PVIRTIONETCC); 926 Log Func(("%s\n", INSTANCE(pThis)));921 Log7Func(("%s\n", INSTANCE(pThis))); 927 922 928 923 RT_NOREF2(pThis, pThisCC); … … 937 932 { 938 933 PVIRTIONET pThis = PDMDEVINS_2_DATA(pDevIns, PVIRTIONET); 939 Log Func(("%s\n", INSTANCE(pThis)));934 Log7Func(("%s\n", INSTANCE(pThis))); 940 935 941 936 virtioNetR3SuspendOrPowerOff(pDevIns, kvirtIoVmStateChangedPowerOff); … … 948 943 { 949 944 PVIRTIONET pThis = PDMDEVINS_2_DATA(pDevIns, PVIRTIONET); 950 Log Func(("%s \n", INSTANCE(pThis)));945 Log7Func(("%s \n", INSTANCE(pThis))); 951 946 virtioNetR3SuspendOrPowerOff(pDevIns, kvirtIoVmStateChangedSuspend); 952 947 } … … 959 954 PVIRTIONET pThis = PDMDEVINS_2_DATA(pDevIns, PVIRTIONET); 960 955 PVIRTIONETCC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PVIRTIONETCC); 961 Log Func(("\n"));956 Log7Func(("\n")); 962 957 963 958 pThisCC->fQuiescing = false; … … 975 970 if (ASMAtomicReadBool(&pThisCC->aWorkers[idxQueue].fSleeping)) 976 971 { 977 Log 6Func(("%s waking %s worker.\n", INSTANCE(pThis), VIRTQNAME(idxQueue)));972 Log7Func(("%s waking %s worker.\n", INSTANCE(pThis), VIRTQNAME(idxQueue))); 978 973 int rc = PDMDevHlpSUPSemEventSignal(pDevIns, pThis->aWorkers[idxQueue].hEvtProcess); 979 974 AssertRC(rc); … … 1020 1015 void virtioNetR3SetReadLed(PVIRTIONETR3 pThisR3, bool fOn) 1021 1016 { 1022 Log 6Func(("%s\n", fOn ? "on" : "off"));1017 Log10Func(("%s\n", fOn ? "on" : "off")); 1023 1018 if (fOn) 1024 1019 pThisR3->led.Asserted.s.fReading = pThisR3->led.Actual.s.fReading = 1; … … 1036 1031 void virtioNetR3SetWriteLed(PVIRTIONETR3 pThisR3, bool fOn) 1037 1032 { 1038 Log 6Func(("%s\n", fOn ? "on" : "off"));1033 Log10Func(("%s\n", fOn ? "on" : "off")); 1039 1034 if (fOn) 1040 1035 pThisR3->led.Asserted.s.fWriting = pThisR3->led.Actual.s.fWriting = 1; … … 1060 1055 if (!pThis->fVirtioReady) 1061 1056 { 1062 Log Func(("%s %s VirtIO not ready (rc = VERR_NET_NO_BUFFER_SPACE)\n", LOGPARAMS));1057 Log8Func(("%s %s VirtIO not ready (rc = VERR_NET_NO_BUFFER_SPACE)\n", LOGPARAMS)); 1063 1058 } 1064 1059 else if (!virtioCoreIsQueueEnabled(&pThis->Virtio, RXQIDX_QPAIR(idxQueue))) 1065 1060 { 1066 Log Func(("%s %s queue not enabled (rc = VERR_NET_NO_BUFFER_SPACE)\n", LOGPARAMS));1061 Log8Func(("%s %s queue not enabled (rc = VERR_NET_NO_BUFFER_SPACE)\n", LOGPARAMS)); 1067 1062 } 1068 1063 else if (virtioCoreQueueIsEmpty(pDevIns, &pThis->Virtio, RXQIDX_QPAIR(idxQueue))) 1069 1064 { 1070 Log Func(("%s %s queue is empty (rc = VERR_NET_NO_BUFFER_SPACE)\n", LOGPARAMS));1065 Log8Func(("%s %s queue is empty (rc = VERR_NET_NO_BUFFER_SPACE)\n", LOGPARAMS)); 1071 1066 virtioCoreQueueSetNotify(&pThis->Virtio, RXQIDX_QPAIR(idxQueue), true); 1072 1067 } 1073 1068 else 1074 1069 { 1075 Log Func(("%s %s ready with available buffers\n", LOGPARAMS));1070 Log8Func(("%s %s ready with available buffers\n", LOGPARAMS)); 1076 1071 virtioCoreQueueSetNotify(&pThis->Virtio, RXQIDX_QPAIR(idxQueue), false); 1077 1072 return VINF_SUCCESS; … … 1124 1119 if (virtioNetR3AreRxBufsAvail(pDevIns, pThis)) 1125 1120 { 1126 Log Func(("%s Rx bufs now available, releasing waiter...\n", INSTANCE(pThis)));1121 Log10Func(("%s Rx bufs now available, releasing waiter...\n", INSTANCE(pThis))); 1127 1122 return VINF_SUCCESS; 1128 1123 } … … 1137 1132 if (virtioNetR3AreRxBufsAvail(pDevIns, pThis)) 1138 1133 { 1139 Log Func(("%s Rx bufs now available, releasing waiter...\n", INSTANCE(pThis)));1134 Log10Func(("%s Rx bufs now available, releasing waiter...\n", INSTANCE(pThis))); 1140 1135 return VINF_SUCCESS; 1141 1136 } 1142 Log Func(("%s Starved for guest Rx bufs, waiting %u ms ...\n",1137 Log9Func(("%s Starved for guest Rx bufs, waiting %u ms ...\n", 1143 1138 INSTANCE(pThis), timeoutMs)); 1144 1139 … … 1155 1150 ASMAtomicXchgBool(&pThis->fLeafWantsRxBuffers, false); 1156 1151 1157 Log FlowFunc(("%s Wait for Rx buffers available was interrupted\n", INSTANCE(pThis)));1152 Log7Func(("%s Wait for Rx buffers available was interrupted\n", INSTANCE(pThis))); 1158 1153 return VERR_INTERRUPTED; 1159 1154 } … … 1250 1245 static bool virtioNetR3AddressFilter(PVIRTIONET pThis, const void *pvBuf, size_t cb) 1251 1246 { 1252 LogFunc(("%s\n", INSTANCE(pThis))); 1247 1248 if (LogIs11Enabled()) 1249 { 1250 char *pszType; 1251 if (virtioNetR3IsMulticast(pvBuf)) 1252 pszType = (char *)"Multicast"; 1253 else if (virtioNetR3IsBroadcast(pvBuf)) 1254 pszType = (char *)"Broadcast"; 1255 else 1256 pszType = (char *)"Unicast"; 1257 1258 LogFunc(("%s node(%RTmac %s%s), pkt(%RTmac %s)", 1259 INSTANCE(pThis), pThis->virtioNetConfig.uMacAddress.au8, 1260 pThis->fPromiscuous ? "promiscuous" : "", 1261 pThis->fAllMulticast ? " all-multicast" : "", 1262 pvBuf, pszType)); 1263 } 1253 1264 1254 1265 if (pThis->fPromiscuous) … … 1262 1273 && !ASMBitTest(pThis->aVlanFilter, RT_BE2H_U16(uPtr[7]) & 0xFFF)) 1263 1274 { 1264 Log 4Func(("%s not our VLAN, returning false\n", INSTANCE(pThis)));1275 Log11Func(("\n%s not our VLAN, returning false\n", INSTANCE(pThis))); 1265 1276 return false; 1266 1277 } 1267 1278 1279 uint8_t src[6] = { 0xA8, 0x20, 0x66, 0x57, 0x50, 0x3C }; 1280 uint8_t dst[6] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; 1281 if (memcmp(pvBuf, dst, 6) == 0 && memcmp(((uint8_t *)pvBuf) + 6, src, 6) == 0) 1282 { 1283 pThis->fLog = true; 1284 virtioNetR3PacketDump(pThis, (const uint8_t *)pvBuf, cb, "<-- Incoming"); 1285 } 1286 1268 1287 if (virtioNetR3IsBroadcast(pvBuf)) 1288 { 1289 Log11(("... accept (broadcast)\n")); 1290 if (LogIs12Enabled()) 1291 virtioNetR3PacketDump(pThis, (const uint8_t *)pvBuf, cb, "<-- Incoming"); 1269 1292 return true; 1270 1293 } 1271 1294 if (pThis->fAllMulticast && virtioNetR3IsMulticast(pvBuf)) 1295 { 1296 Log11(("... accept (all-multicast mode)\n")); 1297 if (LogIs12Enabled()) 1298 virtioNetR3PacketDump(pThis, (const uint8_t *)pvBuf, cb, "<-- Incoming"); 1272 1299 return true; 1300 } 1273 1301 1274 1302 if (!memcmp(pThis->virtioNetConfig.uMacAddress.au8, pvBuf, sizeof(RTMAC))) 1303 { 1304 Log11((". . . accept (direct to this node)\n")); 1305 if (LogIs12Enabled()) 1306 virtioNetR3PacketDump(pThis, (const uint8_t *)pvBuf, cb, "<-- Incoming"); 1275 1307 return true; 1276 1277 Log4Func(("%s : %RTmac (conf) != %RTmac (dest)\n", 1278 INSTANCE(pThis), pThis->virtioNetConfig.uMacAddress.au8, pvBuf)); 1308 } 1279 1309 1280 1310 for (uint16_t i = 0; i < pThis->cMulticastFilterMacs; i++) 1311 { 1281 1312 if (!memcmp(&pThis->aMacMulticastFilter[i], pvBuf, sizeof(RTMAC))) 1313 { 1314 Log11(("... accept (in multicast array)\n")); 1315 if (LogIs12Enabled()) 1316 virtioNetR3PacketDump(pThis, (const uint8_t *)pvBuf, cb, "<-- Incoming"); 1282 1317 return true; 1318 } 1319 } 1283 1320 1284 1321 /** @todo Original combined unicast & multicast into one table. Should we distinguish? */ … … 1286 1323 for (uint16_t i = 0; i < pThis->cUnicastFilterMacs; i++) 1287 1324 if (!memcmp(&pThis->aMacUnicastFilter[i], pvBuf, sizeof(RTMAC))) 1325 { 1326 Log11(("... accept (in unicast array)\n")); 1288 1327 return true; 1289 1290 Log2Func(("%s failed all tests, returning false, packet dump follows:\n", 1291 INSTANCE(pThis))); 1292 1293 virtioNetR3PacketDump(pThis, (const uint8_t *)pvBuf, cb, "<-- Incoming"); 1328 } 1329 1330 if (LogIs12Enabled()) 1331 Log(("... reject\n")); 1294 1332 1295 1333 return false; … … 1316 1354 RT_NOREF(pThisCC); 1317 1355 1318 LogFunc(("%s \n", INSTANCE(pThis)));1356 LogFunc(("%s (%RTmac)\n", INSTANCE(pThis), pvBuf)); 1319 1357 VIRTIONET_PKT_HDR_T rxPktHdr; 1320 1358 … … 1353 1391 } 1354 1392 1355 virtioNetR3PacketDump(pThis, (const uint8_t *)pvBuf, cb, "<-- Incoming");1393 // virtioNetR3PacketDump(pThis, (const uint8_t *)pvBuf, cb, "<-- Incoming"); 1356 1394 1357 1395 uint16_t cSegsAllocated = VIRTIONET_PREALLOCATE_RX_SEG_COUNT; 1358 1396 1359 PRTSGBUF pVirtSegBufToGuest = NULL;1360 PRTSGSEG paVirtSegsToGuest = (PRTSGSEG)RTMemAllocZ(sizeof(RTSGSEG) * cSegsAllocated);1397 PRTSGBUF pVirtSegBufToGuest = (PRTSGBUF)RTMemAllocZ(sizeof(RTSGBUF)); 1398 PRTSGSEG paVirtSegsToGuest = (PRTSGSEG)RTMemAllocZ(sizeof(RTSGSEG) * cSegsAllocated); 1361 1399 AssertReturn(paVirtSegsToGuest, VERR_NO_MEMORY); 1362 1400 … … 1365 1403 1366 1404 uint8_t fAddPktHdr = true; 1367 uint32_t uOffset ;1405 uint32_t uOffset = 0; 1368 1406 1369 1407 while (uOffset < cb) … … 1393 1431 if (fAddPktHdr) 1394 1432 { 1433 LogFunc(("Add pkthdr\n")); 1395 1434 /* Lead with packet header */ 1396 1435 paVirtSegsToGuest[cSegs].cbSeg = sizeof(VIRTIONET_PKT_HDR_T); … … 1398 1437 AssertReturn(paVirtSegsToGuest[0].pvSeg, VERR_NO_MEMORY); 1399 1438 1439 cbDescChainLeft -= sizeof(VIRTIONET_PKT_HDR_T); 1440 1441 memcpy(paVirtSegsToGuest[cSegs].pvSeg, &rxPktHdr, sizeof(VIRTIONET_PKT_HDR_T)); 1442 1400 1443 /* Calculate & cache the field we will need to update later in gcPhys memory */ 1401 1444 gcPhysPktHdrNumBuffers = pDescChain->pSgPhysReturn->paSegs[0].gcPhys 1402 1445 + RT_UOFFSETOF(VIRTIONET_PKT_HDR_T, uNumBuffers); 1403 1446 1404 if (cSegs++ >= cSegsAllocated)1405 {1406 cSegsAllocated <<= 1; /* double the allocation size */1407 paVirtSegsToGuest = (PRTSGSEG)RTMemRealloc(paVirtSegsToGuest, sizeof(RTSGSEG) * cSegsAllocated);1408 AssertReturn(paVirtSegsToGuest, VERR_NO_MEMORY);1409 }1410 1411 1447 fAddPktHdr = false; 1412 cbDescChainLeft -= sizeof(VIRTIONET_PKT_HDR_T);1413 1448 } 1449 if (cSegs++ >= cSegsAllocated) 1450 { 1451 cSegsAllocated <<= 1; /* double the allocation size */ 1452 paVirtSegsToGuest = (PRTSGSEG)RTMemRealloc(paVirtSegsToGuest, sizeof(RTSGSEG) * cSegsAllocated); 1453 AssertReturn(paVirtSegsToGuest, VERR_NO_MEMORY); 1454 } 1455 LogFunc(("Add new post-hdr segment\n")); 1414 1456 1415 1457 /* Append remaining Rx pkt or as much current desc chain has room for */ … … 1421 1463 1422 1464 RTSgBufInit(pVirtSegBufToGuest, paVirtSegsToGuest, cSegs); 1423 1465 //if (pThis->fLog) 1466 // RT_BREAKPOINT(); 1467 Log7Func(("Send Rx pkt to guest...\n")); 1424 1468 virtioCoreR3QueuePut(pDevIns, &pThis->Virtio, RXQIDX_QPAIR(idxQueue), 1425 1469 pVirtSegBufToGuest, pDescChain, true); … … 1438 1482 virtioCoreQueueSync(pDevIns, &pThis->Virtio, RXQIDX_QPAIR(idxQueue)); 1439 1483 1440 for (int i = 0; i < 2; i++)1441 RTMemFree(paVirtSegsToGuest[i].pvSeg);1484 // for (int i = 0; i < cSegs; i++) 1485 // RTMemFree(paVirtSegsToGuest[i].pvSeg); 1442 1486 1443 1487 RTMemFree(paVirtSegsToGuest); 1444 1488 RTMemFree(pVirtSegBufToGuest); 1445 1489 1490 Log7(("\n")); 1446 1491 if (uOffset < cb) 1447 1492 { … … 1449 1494 return VERR_TOO_MUCH_DATA; 1450 1495 } 1451 1496 pThis->fLog = false; 1452 1497 return VINF_SUCCESS; 1453 1498 } … … 1459 1504 size_t cb, PCPDMNETWORKGSO pGso) 1460 1505 { 1461 LogFunc(("\n"));1462 1506 PVIRTIONETCC pThisCC = RT_FROM_MEMBER(pInterface, VIRTIONETCC, INetworkDown); 1463 1507 PPDMDEVINS pDevIns = pThisCC->pDevIns; … … 1502 1546 } 1503 1547 1504 Log 2Func(("%s pvBuf=%p cb=%u pGso=%p\n", INSTANCE(pThis), pvBuf, cb, pGso));1548 Log10Func(("%s pvBuf=%p cb=%3u pGso=%p ...", INSTANCE(pThis), pvBuf, cb, pGso)); 1505 1549 1506 1550 /** @todo If we ever start using more than one Rx/Tx queue pair, is a random queue … … 1658 1702 virtioNetR3PullChain(pDevIns, pThis, pDescChain, &cMacs, sizeof(cMacs)); 1659 1703 cbRemaining -= sizeof(cMacs); 1660 Log 6Func(("%s Guest provided %d unicast MAC Table entries\n", INSTANCE(pThis), cMacs));1704 Log7Func(("%s Guest provided %d unicast MAC Table entries\n", INSTANCE(pThis), cMacs)); 1661 1705 if (cMacs) 1662 1706 { … … 1672 1716 virtioNetR3PullChain(pDevIns, pThis, pDescChain, &cMacs, sizeof(cMacs)); 1673 1717 cbRemaining -= sizeof(cMacs); 1674 Log 6Func(("%s Guest provided %d multicast MAC Table entries\n", INSTANCE(pThis), cMacs));1718 Log10Func(("%s Guest provided %d multicast MAC Table entries\n", INSTANCE(pThis), cMacs)); 1675 1719 if (cMacs) 1676 1720 { … … 1755 1799 RT_MIN(pDescChain->cbPhysSend, sizeof(VIRTIONET_CTRL_HDR_T))); 1756 1800 1757 Log 6Func(("%s CTRL COMMAND: class=%d command=%d\n", INSTANCE(pThis), pCtrlPktHdr->uClass, pCtrlPktHdr->uCmd));1801 Log7Func(("%s CTRL COMMAND: class=%d command=%d\n", INSTANCE(pThis), pCtrlPktHdr->uClass, pCtrlPktHdr->uCmd)); 1758 1802 1759 1803 uint8_t uAck; … … 1783 1827 } 1784 1828 pThis->virtioNetConfig.uStatus &= ~VIRTIONET_F_ANNOUNCE; 1785 Log 6Func(("%s Clearing VIRTIONET_F_ANNOUNCE in config status\n", INSTANCE(pThis)));1829 Log7Func(("%s Clearing VIRTIONET_F_ANNOUNCE in config status\n", INSTANCE(pThis))); 1786 1830 break; 1787 1831 … … 1876 1920 PPDMNETWORKGSO pGso, PVIRTIONET_PKT_HDR_T pPktHdr) 1877 1921 { 1922 LogFunc(("\n")); 1878 1923 virtioNetR3PacketDump(pThis, (uint8_t *)pSgBuf->aSegs[0].pvSeg, pSgBuf->cbUsed, "--> Outgoing"); 1879 1924 if (pGso) … … 1926 1971 uint16_t idxQueue, bool fOnWorkerThread) 1927 1972 { 1973 1974 LogFunc(("\n")); 1928 1975 PVIRTIOCORE pVirtio = &pThis->Virtio; 1929 1976 … … 1963 2010 unsigned int cbPktHdr = sizeof(VIRTIONET_PKT_HDR_T); 1964 2011 1965 Log3Func(("%s About to transmit %d pending packets\n", INSTANCE(pThis), 1966 virtioCoreR3QueuePendingCount(pVirtio->pDevIns, pVirtio, idxQueue))); 2012 int cPkts = virtioCoreR3QueuePendingCount(pVirtio->pDevIns, pVirtio, idxQueue); 2013 if (!cPkts) 2014 { 2015 LogFunc(("%s No packets to send found on %s\n", INSTANCE(pThis), VIRTQNAME(idxQueue))); 2016 2017 if (pDrv) 2018 pDrv->pfnEndXmit(pDrv); 2019 2020 ASMAtomicWriteU32(&pThis->uIsTransmitting, 0); 2021 return; 2022 } 2023 LogFunc(("%s About to transmit %d pending packets\n", INSTANCE(pThis), cPkts)); 1967 2024 1968 2025 virtioNetR3SetWriteLed(pThisCC, true); … … 1973 2030 { 1974 2031 if (RT_SUCCESS(rc)) 1975 Log 6Func(("%s fetched descriptor chain from %s\n", INSTANCE(pThis), VIRTQNAME(idxQueue)));2032 Log10Func(("%s fetched descriptor chain from %s\n", INSTANCE(pThis), VIRTQNAME(idxQueue))); 1976 2033 else 1977 2034 { 1978 LogFunc(("%s Failedfind expected data on %s, rc = %Rrc\n", INSTANCE(pThis), VIRTQNAME(idxQueue), rc));2035 LogFunc(("%s failed to find expected data on %s, rc = %Rrc\n", INSTANCE(pThis), VIRTQNAME(idxQueue), rc)); 1979 2036 break; 1980 2037 } … … 2065 2122 static DECLCALLBACK(void) virtioNetR3NetworkDown_XmitPending(PPDMINETWORKDOWN pInterface) 2066 2123 { 2124 LogFunc(("\n")); 2067 2125 PVIRTIONETCC pThisCC = RT_FROM_MEMBER(pInterface, VIRTIONETCC, INetworkDown); 2068 2126 PPDMDEVINS pDevIns = pThisCC->pDevIns; … … 2071 2129 /** @todo If we ever start using more than one Rx/Tx queue pair, is a random queue 2072 2130 selection algorithm feasible or even necessary */ 2073 LogFunc(("\n"));2074 2131 virtioNetR3TransmitPendingPackets(pDevIns, pThis, pThisCC, TXQIDX_QPAIR(0), false /*fOnWorkerThread*/); 2075 2132 } … … 2091 2148 #endif 2092 2149 2093 Log 6Func(("%s %s has available buffers\n", INSTANCE(pThis), VIRTQNAME(idxQueue)));2150 Log10Func(("%s %s has available buffers\n", INSTANCE(pThis), VIRTQNAME(idxQueue))); 2094 2151 2095 2152 if (IS_RX_QUEUE(idxQueue)) 2096 2153 { 2097 Log Func(("%s Receive buffers have been added, waking Rx thread.\n",2154 Log10Func(("%s Receive buffers have been added, waking Rx thread.\n", 2098 2155 INSTANCE(pThis))); 2099 2156 virtioNetR3WakeupRxBufWaiter(pDevIns); … … 2106 2163 if (ASMAtomicReadBool(&pWorkerR3->fSleeping)) 2107 2164 { 2108 Log 6Func(("%s waking %s worker.\n", INSTANCE(pThis), VIRTQNAME(idxQueue)));2165 Log10Func(("%s waking %s worker.\n", INSTANCE(pThis), VIRTQNAME(idxQueue))); 2109 2166 int rc = PDMDevHlpSUPSemEventSignal(pDevIns, pWorker->hEvtProcess); 2110 2167 AssertRC(rc); … … 2140 2197 if (!fNotificationSent) 2141 2198 { 2142 Log 6Func(("%s %s worker sleeping...\n", INSTANCE(pThis), VIRTQNAME(idxQueue)));2199 Log10Func(("%s %s worker sleeping...\n", INSTANCE(pThis), VIRTQNAME(idxQueue))); 2143 2200 Assert(ASMAtomicReadBool(&pWorkerR3->fSleeping)); 2144 2201 int rc = PDMDevHlpSUPSemEventWaitNoResume(pDevIns, pWorker->hEvtProcess, RT_INDEFINITE_WAIT); … … 2151 2208 continue; 2152 2209 } 2153 Log 6Func(("%s %s worker woken\n", INSTANCE(pThis), VIRTQNAME(idxQueue)));2210 Log10Func(("%s %s worker woken\n", INSTANCE(pThis), VIRTQNAME(idxQueue))); 2154 2211 ASMAtomicWriteBool(&pWorkerR3->fNotified, false); 2155 2212 } … … 2164 2221 if (IS_CTRL_QUEUE(idxQueue)) 2165 2222 { 2166 Log 6Func(("%s fetching next descriptor chain from %s\n", INSTANCE(pThis), VIRTQNAME(idxQueue)));2223 Log10Func(("%s fetching next descriptor chain from %s\n", INSTANCE(pThis), VIRTQNAME(idxQueue))); 2167 2224 PVIRTIO_DESC_CHAIN_T pDescChain; 2168 2225 int rc = virtioCoreR3QueueGet(pDevIns, &pThis->Virtio, idxQueue, &pDescChain, true); 2169 2226 if (rc == VERR_NOT_AVAILABLE) 2170 2227 { 2171 Log 6Func(("%s Nothing found in %s\n", INSTANCE(pThis), VIRTQNAME(idxQueue)));2228 Log10Func(("%s Nothing found in %s\n", INSTANCE(pThis), VIRTQNAME(idxQueue))); 2172 2229 continue; 2173 2230 } … … 2176 2233 else if (IS_TX_QUEUE(idxQueue)) 2177 2234 { 2178 Log6Func(("%s Notified of data to transmit\n", INSTANCE(pThis))); 2235 LogFunc(("Worker thread notified of pending Xmit packets!!!!!!\n")); 2236 Log10Func(("%s Notified of data to transmit\n", INSTANCE(pThis))); 2179 2237 virtioNetR3TransmitPendingPackets(pDevIns, pThis, pThisCC, 2180 2238 idxQueue, true /* fOnWorkerThread */); … … 2279 2337 bool fActiveLinkIsUp = (enmState == PDMNETWORKLINKSTATE_UP); 2280 2338 2281 Log Func(("%s enmState=%d\n", INSTANCE(pThis), enmState));2339 Log7Func(("%s enmState=%d\n", INSTANCE(pThis), enmState)); 2282 2340 if (enmState == PDMNETWORKLINKSTATE_DOWN_RESUME) 2283 2341 { … … 2319 2377 static int virtioNetR3DestroyWorkerThreads(PPDMDEVINS pDevIns, PVIRTIONET pThis, PVIRTIONETCC pThisCC) 2320 2378 { 2321 Log Func(("%s\n", INSTANCE(pThis)));2379 Log10Func(("%s\n", INSTANCE(pThis))); 2322 2380 int rc = VINF_SUCCESS; 2323 2381 for (unsigned idxQueue = 0; idxQueue < pThis->cVirtQueues; idxQueue++) … … 2343 2401 static int virtioNetR3CreateWorkerThreads(PPDMDEVINS pDevIns, PVIRTIONET pThis, PVIRTIONETCC pThisCC) 2344 2402 { 2345 LogFunc(("%s\n", INSTANCE(pThis))); 2346 2403 Log10Func(("%s\n", INSTANCE(pThis))); 2347 2404 int rc = VINF_SUCCESS; 2348 2405 /* Attach the queues and create worker threads for them: */ … … 2350 2407 { 2351 2408 /* Skip creating threads for receive queues, only create for transmit queues & control queue */ 2352 if (IS_RX_QUEUE(idxQueue)) 2353 continue; 2354 2355 rc = PDMDevHlpSUPSemEventCreate(pDevIns, &pThis->aWorkers[idxQueue].hEvtProcess); 2356 2357 if (RT_FAILURE(rc)) 2358 return PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS, 2359 N_("DevVirtioNET: Failed to create SUP event semaphore")); 2360 2361 rc = PDMDevHlpThreadCreate(pDevIns, &pThisCC->aWorkers[idxQueue].pThread, 2362 (void *)(uintptr_t)idxQueue, virtioNetR3WorkerThread, 2363 virtioNetR3WakeupWorker, 0, RTTHREADTYPE_IO, VIRTQNAME(idxQueue)); 2364 if (rc != VINF_SUCCESS) 2409 if (!IS_RX_QUEUE(idxQueue)) 2365 2410 { 2366 LogRel(("Error creating thread for Virtual Queue %s: %Rrc\n", VIRTQNAME(idxQueue), rc)); 2367 return rc; 2411 rc = PDMDevHlpSUPSemEventCreate(pDevIns, &pThis->aWorkers[idxQueue].hEvtProcess); 2412 2413 if (RT_FAILURE(rc)) 2414 return PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS, 2415 N_("DevVirtioNET: Failed to create SUP event semaphore")); 2416 2417 rc = PDMDevHlpThreadCreate(pDevIns, &pThisCC->aWorkers[idxQueue].pThread, 2418 (void *)(uintptr_t)idxQueue, virtioNetR3WorkerThread, 2419 virtioNetR3WakeupWorker, 0, RTTHREADTYPE_IO, VIRTQNAME(idxQueue)); 2420 if (rc != VINF_SUCCESS) 2421 { 2422 LogRel(("Error creating thread for Virtual Queue %s: %Rrc\n", VIRTQNAME(idxQueue), rc)); 2423 return rc; 2424 } 2368 2425 } 2369 2370 2426 pThis->afQueueAttached[idxQueue] = true; 2371 2427 } … … 2380 2436 PVIRTIONET pThis = RT_FROM_MEMBER(pVirtio, VIRTIONET, Virtio); 2381 2437 PVIRTIONETCC pThisCC = RT_FROM_MEMBER(pVirtioCC, VIRTIONETCC, Virtio); 2382 2383 LogFunc(("%s\n", INSTANCE(pThis)));2384 2438 2385 2439 pThis->fVirtioReady = fVirtioReady; … … 2397 2451 (void) virtioCoreR3QueueAttach(&pThis->Virtio, idxQueue, VIRTQNAME(idxQueue)); 2398 2452 pThis->afQueueAttached[idxQueue] = true; 2453 virtioCoreQueueIsEmpty(pThisCC->pDevIns, &pThis->Virtio, idxQueue); 2399 2454 virtioCoreQueueSetNotify(&pThis->Virtio, idxQueue, true); 2400 2455 } … … 2405 2460 2406 2461 pThis->virtioNetConfig.uStatus = pThis->fCableConnected ? VIRTIONET_F_LINK_UP : 0; 2407 Log Func(("%s Link is %s\n", INSTANCE(pThis), pThis->fCableConnected ? "up" : "down"));2462 Log7Func(("%s Link is %s\n", INSTANCE(pThis), pThis->fCableConnected ? "up" : "down")); 2408 2463 2409 2464 pThis->fPromiscuous = true; … … 2442 2497 PVIRTIONETCC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PVIRTIONETCC); 2443 2498 2444 Log Func(("%s\n", INSTANCE(pThis)));2499 Log7Func(("%s\n", INSTANCE(pThis))); 2445 2500 AssertLogRelReturnVoid(iLUN == 0); 2446 2501 … … 2469 2524 RT_NOREF(fFlags); 2470 2525 2471 Log Func(("%s", INSTANCE(pThis)));2526 Log7Func(("%s", INSTANCE(pThis))); 2472 2527 2473 2528 AssertLogRelReturn(iLUN == 0, VERR_PDM_NO_SUCH_LUN); … … 2560 2615 * Quick initialization of the state data, making sure that the destructor always works. 2561 2616 */ 2562 Log Func(("PDM device instance: %d\n", iInstance));2617 Log7Func(("PDM device instance: %d\n", iInstance)); 2563 2618 2564 2619
Note:
See TracChangeset
for help on using the changeset viewer.