Changeset 41809 in vbox
- Timestamp:
- Jun 18, 2012 6:39:51 AM (13 years ago)
- svn:sync-xref-src-repo-rev:
- 78627
- Location:
- trunk/src/VBox/Devices
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/DevVirtioNet.cpp
r41409 r41809 1074 1074 1075 1075 VQUEUEELEM elem; 1076 while (vqueueGet(&pState->VPCI, pQueue, &elem)) 1076 /* 1077 * Do not remove descriptors from available ring yet, try to allocate the 1078 * buffer first. 1079 */ 1080 while (vqueuePeek(&pState->VPCI, pQueue, &elem)) 1077 1081 { 1078 1082 unsigned int uOffset = 0; … … 1165 1169 } 1166 1170 else 1167 LogRel(("virtio-net: failed to allocate SG buffer: size=%u rc=%Rrc\n", uSize, rc)); 1171 { 1172 Log4(("virtio-net: failed to allocate SG buffer: size=%u rc=%Rrc\n", uSize, rc)); 1173 STAM_PROFILE_STOP(&pState->StatTransmitSend, a); 1174 STAM_PROFILE_ADV_STOP(&pState->StatTransmit, a); 1175 /* Stop trying to fetch TX descriptors until we get more bandwidth. */ 1176 break; 1177 } 1168 1178 1169 1179 STAM_PROFILE_STOP(&pState->StatTransmitSend, a); … … 1171 1181 } 1172 1182 } 1183 /* Remove this descriptor chain from the available ring */ 1184 vqueueSkip(&pState->VPCI, pQueue); 1173 1185 vqueuePut(&pState->VPCI, pQueue, &elem, sizeof(VNETHDR) + uOffset); 1174 1186 vqueueSync(&pState->VPCI, pQueue); -
trunk/src/VBox/Devices/VirtIO/Virtio.cpp
r40280 r41809 111 111 } 112 112 113 bool vqueue Get(PVPCISTATE pState, PVQUEUE pQueue, PVQUEUEELEM pElem)113 bool vqueueSkip(PVPCISTATE pState, PVQUEUE pQueue) 114 114 { 115 115 if (vqueueIsEmpty(pState, pQueue)) 116 116 return false; 117 117 118 Log2(("%s vqueueSkip: %s avail_idx=%u\n", INSTANCE(pState), 119 QUEUENAME(pState, pQueue), pQueue->uNextAvailIndex)); 120 pQueue->uNextAvailIndex++; 121 return true; 122 } 123 124 bool vqueueGet(PVPCISTATE pState, PVQUEUE pQueue, PVQUEUEELEM pElem, bool fRemove) 125 { 126 if (vqueueIsEmpty(pState, pQueue)) 127 return false; 128 118 129 pElem->nIn = pElem->nOut = 0; 119 130 … … 122 133 123 134 VRINGDESC desc; 124 uint16_t idx = vringReadAvail(pState, &pQueue->VRing, pQueue->uNextAvailIndex++); 135 uint16_t idx = vringReadAvail(pState, &pQueue->VRing, pQueue->uNextAvailIndex); 136 if (fRemove) 137 pQueue->uNextAvailIndex++; 125 138 pElem->uIndex = idx; 126 139 do -
trunk/src/VBox/Devices/VirtIO/Virtio.h
r39091 r41809 304 304 } 305 305 306 bool vqueueGet(PVPCISTATE pState, PVQUEUE pQueue, PVQUEUEELEM pElem); 306 bool vqueueSkip(PVPCISTATE pState, PVQUEUE pQueue); 307 bool vqueueGet(PVPCISTATE pState, PVQUEUE pQueue, PVQUEUEELEM pElem, bool fRemove = true); 307 308 void vqueuePut(PVPCISTATE pState, PVQUEUE pQueue, PVQUEUEELEM pElem, uint32_t uLen, uint32_t uReserved = 0); 308 309 void vqueueNotify(PVPCISTATE pState, PVQUEUE pQueue); 309 310 void vqueueSync(PVPCISTATE pState, PVQUEUE pQueue); 310 311 312 DECLINLINE(bool) vqueuePeek(PVPCISTATE pState, PVQUEUE pQueue, PVQUEUEELEM pElem) 313 { 314 return vqueueGet(pState, pQueue, pElem, /* fRemove */ false); 315 } 311 316 312 317 DECLINLINE(bool) vqueueIsReady(PVPCISTATE pState, PVQUEUE pQueue)
Note:
See TracChangeset
for help on using the changeset viewer.