Changeset 81731 in vbox for trunk/src/VBox
- Timestamp:
- Nov 6, 2019 9:35:07 PM (5 years ago)
- Location:
- trunk/src/VBox/Devices
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/DevVirtioNet.cpp
r81727 r81731 938 938 } 939 939 940 if (elem. nIn < 1)940 if (elem.cIn < 1) 941 941 { 942 942 Log(("%s vnetR3HandleRxPacket: No writable descriptors in receive queue!\n", INSTANCE(pThis))); … … 963 963 uElemSize += cbHdr; 964 964 } 965 while (nSeg < elem. nIn && uOffset < cb)965 while (nSeg < elem.cIn && uOffset < cb) 966 966 { 967 967 unsigned int uSize = (unsigned int)RT_MIN(elem.aSegsIn[nSeg].cb - (nSeg?0:cbReserved), … … 1373 1373 { 1374 1374 unsigned int uOffset = 0; 1375 if (elem. nOut < 2 || elem.aSegsOut[0].cb != cbHdr)1375 if (elem.cOut < 2 || elem.aSegsOut[0].cb != cbHdr) 1376 1376 { 1377 1377 Log(("%s vnetR3QueueTransmit: The first segment is not the header! (%u < 2 || %u != %u).\n", 1378 INSTANCE(pThis), elem. nOut, elem.aSegsOut[0].cb, cbHdr));1378 INSTANCE(pThis), elem.cOut, elem.aSegsOut[0].cb, cbHdr)); 1379 1379 break; /* For now we simply ignore the header, but it must be there anyway! */ 1380 1380 } … … 1386 1386 1387 1387 /* Compute total frame size. */ 1388 for (unsigned int i = 1; i < elem. nOut && uSize < VNET_MAX_FRAME_SIZE; i++)1388 for (unsigned int i = 1; i < elem.cOut && uSize < VNET_MAX_FRAME_SIZE; i++) 1389 1389 uSize += elem.aSegsOut[i].cb; 1390 1390 Log5(("%s vnetR3TransmitPendingPackets: complete frame is %u bytes.\n", INSTANCE(pThis), uSize)); … … 1412 1412 1413 1413 /* Assemble a complete frame. */ 1414 for (unsigned int i = 1; i < elem. nOut && uSize > 0; i++)1414 for (unsigned int i = 1; i < elem.cOut && uSize > 0; i++) 1415 1415 { 1416 1416 unsigned int cbSegment = RT_MIN(uSize, elem.aSegsOut[i].cb); … … 1662 1662 1663 1663 if ( pCtlHdr->u8Command != VNET_CTRL_CMD_MAC_TABLE_SET 1664 || pElem-> nOut != 31664 || pElem->cOut != 3 1665 1665 || pElem->aSegsOut[1].cb < sizeof(nMacs) 1666 1666 || pElem->aSegsOut[2].cb < sizeof(nMacs)) 1667 1667 { 1668 1668 Log(("%s vnetR3ControlMac: Segment layout is wrong (u8Command=%u nOut=%u cb1=%u cb2=%u)\n", 1669 INSTANCE(pThis), pCtlHdr->u8Command, pElem-> nOut, pElem->aSegsOut[1].cb, pElem->aSegsOut[2].cb));1669 INSTANCE(pThis), pCtlHdr->u8Command, pElem->cOut, pElem->aSegsOut[1].cb, pElem->aSegsOut[2].cb)); 1670 1670 return VNET_ERROR; 1671 1671 } … … 1737 1737 uint16_t u16Vid; 1738 1738 1739 if (pElem-> nOut != 2 || pElem->aSegsOut[1].cb != sizeof(u16Vid))1739 if (pElem->cOut != 2 || pElem->aSegsOut[1].cb != sizeof(u16Vid)) 1740 1740 { 1741 1741 Log(("%s vnetR3ControlVlan: Segment layout is wrong (u8Command=%u nOut=%u cb=%u)\n", 1742 INSTANCE(pThis), pCtlHdr->u8Command, pElem-> nOut, pElem->aSegsOut[1].cb));1742 INSTANCE(pThis), pCtlHdr->u8Command, pElem->cOut, pElem->aSegsOut[1].cb)); 1743 1743 return VNET_ERROR; 1744 1744 } … … 1781 1781 while (vqueueGet(pDevIns, &pThis->VPCI, pQueue, &elem)) 1782 1782 { 1783 if (elem. nOut < 1 || elem.aSegsOut[0].cb < sizeof(VNETCTLHDR))1783 if (elem.cOut < 1 || elem.aSegsOut[0].cb < sizeof(VNETCTLHDR)) 1784 1784 { 1785 1785 Log(("%s vnetR3QueueControl: The first 'out' segment is not the header! (%u < 1 || %u < %u).\n", 1786 INSTANCE(pThis), elem. nOut, elem.aSegsOut[0].cb,sizeof(VNETCTLHDR)));1786 INSTANCE(pThis), elem.cOut, elem.aSegsOut[0].cb,sizeof(VNETCTLHDR))); 1787 1787 break; /* Skip the element and hope the next one is good. */ 1788 1788 } 1789 if ( elem. nIn < 11790 || elem.aSegsIn[elem. nIn - 1].cb < sizeof(VNETCTLACK))1789 if ( elem.cIn < 1 1790 || elem.aSegsIn[elem.cIn - 1].cb < sizeof(VNETCTLACK)) 1791 1791 { 1792 1792 Log(("%s vnetR3QueueControl: The last 'in' segment is too small to hold the acknowledge! (%u < 1 || %u < %u).\n", 1793 INSTANCE(pThis), elem. nIn, elem.aSegsIn[elem.nIn - 1].cb, sizeof(VNETCTLACK)));1793 INSTANCE(pThis), elem.cIn, elem.aSegsIn[elem.cIn - 1].cb, sizeof(VNETCTLACK))); 1794 1794 break; /* Skip the element and hope the next one is good. */ 1795 1795 } … … 1813 1813 } 1814 1814 Log(("%s Processed control message %u, ack=%u.\n", INSTANCE(pThis), CtlHdr.u8Class, bAck)); 1815 PDMDevHlpPCIPhysWrite(pDevIns, elem.aSegsIn[elem. nIn - 1].addr, &bAck, sizeof(bAck));1815 PDMDevHlpPCIPhysWrite(pDevIns, elem.aSegsIn[elem.cIn - 1].addr, &bAck, sizeof(bAck)); 1816 1816 1817 1817 vqueuePut(pDevIns, &pThis->VPCI, pQueue, &elem, sizeof(bAck)); … … 1829 1829 PVNETSTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVNETSTATE); 1830 1830 RT_NOREF(cArgs, papszArgs); 1831 vpc R3iDumpStateWorker(&pThis->VPCI, pHlp);1831 vpciR3DumpStateWorker(&pThis->VPCI, pHlp); 1832 1832 } 1833 1833 -
trunk/src/VBox/Devices/VirtIO/Virtio.cpp
r81722 r81731 113 113 return false; 114 114 115 pElem-> nIn = pElem->nOut = 0;115 pElem->cIn = pElem->cOut = 0; 116 116 117 117 Log2(("%s vqueueGet: %s avail_idx=%u\n", INSTANCE(pThis), pQueue->szName, pQueue->uNextAvailIndex)); … … 132 132 * total number of descriptors in the ring (see @bugref{8620}). 133 133 */ 134 if (pElem-> nIn + pElem->nOut >= VRING_MAX_SIZE)134 if (pElem->cIn + pElem->cOut >= VRING_MAX_SIZE) 135 135 { 136 136 static volatile uint32_t s_cMessages = 0; … … 153 153 { 154 154 Log2(("%s vqueueGet: %s IN seg=%u desc_idx=%u addr=%p cb=%u\n", INSTANCE(pThis), 155 pQueue->szName, pElem-> nIn, idx, desc.u64Addr, desc.uLen));156 pSeg = &pElem->aSegsIn[pElem-> nIn++];155 pQueue->szName, pElem->cIn, idx, desc.u64Addr, desc.uLen)); 156 pSeg = &pElem->aSegsIn[pElem->cIn++]; 157 157 } 158 158 else 159 159 { 160 160 Log2(("%s vqueueGet: %s OUT seg=%u desc_idx=%u addr=%p cb=%u\n", INSTANCE(pThis), 161 pQueue->szName, pElem-> nOut, idx, desc.u64Addr, desc.uLen));162 pSeg = &pElem->aSegsOut[pElem-> nOut++];161 pQueue->szName, pElem->cOut, idx, desc.u64Addr, desc.uLen)); 162 pSeg = &pElem->aSegsOut[pElem->cOut++]; 163 163 } 164 164 … … 171 171 172 172 Log2(("%s vqueueGet: %s head_desc_idx=%u nIn=%u nOut=%u\n", INSTANCE(pThis), 173 pQueue->szName, pElem->uIndex, pElem-> nIn, pElem->nOut));173 pQueue->szName, pElem->uIndex, pElem->cIn, pElem->cOut)); 174 174 return true; 175 175 } … … 212 212 uint32_t cbSkip = uReserved; 213 213 214 for (unsigned i = 0; i < pElem-> nIn && cbLen > 0; ++i)214 for (unsigned i = 0; i < pElem->cIn && cbLen > 0; ++i) 215 215 { 216 216 if (cbSkip >= pElem->aSegsIn[i].cb) /* segment completely skipped? */ … … 659 659 * Dumps the state (useful for both logging and info items). 660 660 */ 661 void vpc R3iDumpStateWorker(PVPCISTATE pThis, PCDBGFINFOHLP pHlp)661 void vpciR3DumpStateWorker(PVPCISTATE pThis, PCDBGFINFOHLP pHlp) 662 662 { 663 663 … … 698 698 { 699 699 Log2(("vpciR3DumpState: (called from %s)\n", pcszCaller)); 700 vpc R3iDumpStateWorker(pThis, DBGFR3InfoLogHlp());700 vpciR3DumpStateWorker(pThis, DBGFR3InfoLogHlp()); 701 701 } 702 702 } -
trunk/src/VBox/Devices/VirtIO/Virtio.h
r81722 r81731 53 53 #define DEVICE_PCI_BASE_ID 0x1000 54 54 #define DEVICE_PCI_SUBSYSTEM_VENDOR_ID 0x1AF4 55 #define DEVICE_PCI_SUBSYSTEM_BASE_ID 155 #define DEVICE_PCI_SUBSYSTEM_BASE_ID 1 56 56 57 57 #define VIRTIO_MAX_NQUEUES 3 … … 75 75 #define VPCI_STATUS_FAILED 0x80 76 76 77 #define VPCI_F_NOTIFY_ON_EMPTY 0x0100000078 #define VPCI_F_ANY_LAYOUT 0x0800000079 #define VPCI_F_RING_INDIRECT_DESC 0x1000000080 #define VPCI_F_RING_EVENT_IDX 0x2000000081 #define VPCI_F_BAD_FEATURE 0x4000000077 #define VPCI_F_NOTIFY_ON_EMPTY UINT32_C(0x01000000) 78 #define VPCI_F_ANY_LAYOUT UINT32_C(0x08000000) 79 #define VPCI_F_RING_INDIRECT_DESC UINT32_C(0x10000000) 80 #define VPCI_F_RING_EVENT_IDX UINT32_C(0x20000000) 81 #define VPCI_F_BAD_FEATURE UINT32_C(0x40000000) 82 82 83 83 #define VRINGDESC_MAX_SIZE (2 * 1024 * 1024) … … 86 86 #define VRINGDESC_F_INDIRECT 0x04 87 87 88 typedef struct VR ingDesc88 typedef struct VRINGDESC 89 89 { 90 90 uint64_t u64Addr; … … 95 95 typedef VRINGDESC *PVRINGDESC; 96 96 97 #define VRINGAVAIL_F_NO_INTERRUPT 0x0198 99 typedef struct VR ingAvail97 #define VRINGAVAIL_F_NO_INTERRUPT 0x01 98 99 typedef struct VRINGAVAIL 100 100 { 101 101 uint16_t uFlags; … … 104 104 } VRINGAVAIL; 105 105 106 typedef struct VR ingUsedElem106 typedef struct VRINGUSEDELEM 107 107 { 108 108 uint32_t uId; … … 120 120 typedef VRINGUSED *PVRINGUSED; 121 121 122 #define VRING_MAX_SIZE 1024123 124 typedef struct VR ing122 #define VRING_MAX_SIZE 1024 123 124 typedef struct VRING 125 125 { 126 126 uint16_t uSize; … … 158 158 typedef VQUEUER3 *PVQUEUER3; 159 159 160 typedef struct VQ ueueElemSeg160 typedef struct VQUEUESEG 161 161 { 162 162 RTGCPHYS addr; … … 165 165 } VQUEUESEG; 166 166 167 typedef struct VQ ueueElem167 typedef struct VQUEUEELEM 168 168 { 169 169 uint32_t uIndex; 170 uint32_t nIn;171 uint32_t nOut;170 uint32_t cIn; 171 uint32_t cOut; 172 172 VQUEUESEG aSegsIn[VRING_MAX_SIZE]; 173 173 VQUEUESEG aSegsOut[VRING_MAX_SIZE]; … … 282 282 int vpciRZInit(PPDMDEVINS pDevIns, PVPCISTATE pThis, PVPCISTATECC pThisCC); 283 283 int vpciR3Term(PPDMDEVINS pDevIns, PVPCISTATE pThis); 284 284 PVQUEUE vpciR3AddQueue(PVPCISTATE pThis, PVPCISTATECC pThisCC, unsigned uSize, PFNVPCIQUEUECALLBACK pfnCallback, const char *pcszName); 285 void *vpciR3QueryInterface(PVPCISTATECC pThisCC, const char *pszIID); 286 void vpciR3SetWriteLed(PVPCISTATE pThis, bool fOn); 287 void vpciR3SetReadLed(PVPCISTATE pThis, bool fOn); 288 int vpciR3SaveExec(PCPDMDEVHLPR3 pHlp, PVPCISTATE pThis, PSSMHANDLE pSSM); 289 int vpciR3LoadExec(PCPDMDEVHLPR3 pHlp, PVPCISTATE pThis, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass, uint32_t cQueues); 290 void vpciR3DumpStateWorker(PVPCISTATE pThis, PCDBGFINFOHLP pHlp); 291 292 void vpciReset(PPDMDEVINS pDevIns, PVPCISTATE pThis); 285 293 int vpciRaiseInterrupt(PPDMDEVINS pDevIns, PVPCISTATE pThis, int rcBusy, uint8_t u8IntCause); 286 294 int vpciIOPortIn(PPDMDEVINS pDevIns, PVPCISTATE pThis, RTIOPORT offPort, … … 288 296 int vpciIOPortOut(PPDMDEVINS pDevIns, PVPCISTATE pThis, PVPCISTATECC pThisCC, RTIOPORT offPort, 289 297 uint32_t u32, unsigned cb, PCVPCIIOCALLBACKS pCallbacks); 290 291 void vpciR3SetWriteLed(PVPCISTATE pThis, bool fOn);292 void vpciR3SetReadLed(PVPCISTATE pThis, bool fOn);293 int vpciR3SaveExec(PCPDMDEVHLPR3 pHlp, PVPCISTATE pThis, PSSMHANDLE pSSM);294 int vpciR3LoadExec(PCPDMDEVHLPR3 pHlp, PVPCISTATE pThis, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass, uint32_t cQueues);295 void vpciReset(PPDMDEVINS pDevIns, PVPCISTATE pThis);296 void *vpciR3QueryInterface(PVPCISTATECC pThisCC, const char *pszIID);297 PVQUEUE vpciR3AddQueue(PVPCISTATE pThis, PVPCISTATECC pThisCC, unsigned uSize, PFNVPCIQUEUECALLBACK pfnCallback, const char *pcszName);298 298 299 299 #define VPCI_CS … … 347 347 } 348 348 349 void vpcR3iDumpStateWorker(PVPCISTATE pThis, PCDBGFINFOHLP pHlp);350 351 349 #endif /* !VBOX_INCLUDED_SRC_VirtIO_Virtio_h */ 350
Note:
See TracChangeset
for help on using the changeset viewer.