Changeset 587 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Feb 4, 2007 11:42:27 AM (18 years ago)
- Location:
- trunk/src/VBox/Devices/Network
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/DevPCNet.cpp
r575 r587 80 80 /* Enable to handle frequent io reads in the guest context */ 81 81 #define PCNET_GC_ENABLED 82 83 /* Enable to send multiple packets with one system call */84 /* #define PCNET_SEND_MULTIPLE_PACKETS */85 82 86 83 /* Enable to delay setting the TX interrupt until packets have been sent. */ … … 1826 1823 pData->fTransmitting = true; 1827 1824 1828 #ifdef PCNET_SEND_MULTIPLE_PACKETS1829 if (pData->iFrame)1830 {1831 if (pData->iFrame > 1)1832 {1833 /** @todo Tip, use alloca() or a fixed sized stack array to save time and avoid the heap and it's locks. */1834 PPDMINETWORKPACKET paPacket = (PPDMINETWORKPACKET)RTMemTmpAlloc(sizeof(PDMINETWORKPACKET)*pData->iFrame);1835 unsigned i;1836 1837 Assert(paPacket);1838 if (paPacket)1839 {1840 for (i = 0; i < pData->iFrame; i++)1841 {1842 paPacket[i].pvBuf = pData->aFrames[i].pvR3 != NIL_RTR3PTR1843 ? pData->aFrames[i].pvR31844 : &pData->abFrameBuf[pData->aFrames[i].off];1845 paPacket[i].cb = pData->aFrames[i].cb;1846 1847 if (pData->aFrames[i].cb > 70) /* unqualified guess */1848 pData->Led.Asserted.s.fWriting = pData->Led.Actual.s.fWriting = 1;1849 }1850 1851 if (pcnetIsLinkUp(pData))1852 pData->pDrv->pfnSendEx(pData->pDrv, pData->iFrame, paPacket);1853 1854 RTMemTmpFree(paPacket);1855 }1856 }1857 else1858 {1859 RTR3PTR pv = pData->aFrames[0].pvR3 != NIL_RTR3PTR1860 ? pData->aFrames[0].pvR31861 : &pData->abFrameBuf[pData->aFrames[0].off];1862 if (pData->aFrames[0].cb > 70) /* unqualified guess */1863 pData->Led.Asserted.s.fWriting = pData->Led.Actual.s.fWriting = 1;1864 if (pcnetIsLinkUp(pData))1865 {1866 pData->pDrv->pfnSend(pData->pDrv, pv, pData->aFrames[0].cb);1867 LOG_PACKET("xmit", pv, pData->aFrames[0].cb);1868 }1869 }1870 1871 #ifdef PCNET_DELAY_INT1872 /* Update TXSTRT and TINT. */1873 pData->aCSR[4] |= 0x0004; /* set TXSTRT */1874 pData->aCSR[0] |= 0x0200; /* set TINT */1875 pcnetUpdateIrq(pData);1876 #endif1877 }1878 1879 #else /* PCNET_SEND_MULTIPLE_PACKETS */1880 1881 1825 for (unsigned i = 0; i < pData->iFrame; i++) 1882 1826 { … … 1902 1846 } 1903 1847 #endif 1904 1905 #endif /* PCNET_SEND_MULTIPLE_PACKETS */1906 1848 1907 1849 pData->fTransmitting = false; -
trunk/src/VBox/Devices/Network/DrvIntNet.cpp
r574 r587 154 154 } 155 155 156 157 /**158 * Send multiple data packets to the network.159 *160 * @returns VBox status code.161 * @param pInterface Pointer to the interface structure containing the called function pointer.162 * @param cPackets Number of packets163 * @param paPacket Packet description array164 * @thread EMT165 */166 static DECLCALLBACK(int) drvIntNetSendEx(PPDMINETWORKCONNECTOR pInterface, uint32_t cPackets, PPDMINETWORKPACKET paPacket)167 {168 int rc = VERR_INVALID_PARAMETER;169 170 for (uint32_t i = 0; i < cPackets; i++)171 {172 rc = drvIntNetSend(pInterface, paPacket[i].pvBuf, paPacket[i].cb);173 if (VBOX_FAILURE(rc))174 break;175 }176 return rc;177 }178 156 179 157 /** … … 633 611 /* INetwork */ 634 612 pThis->INetworkConnector.pfnSend = drvIntNetSend; 635 pThis->INetworkConnector.pfnSendEx = drvIntNetSendEx;636 613 pThis->INetworkConnector.pfnSetPromiscuousMode = drvIntNetSetPromiscuousMode; 637 614 pThis->INetworkConnector.pfnNotifyLinkChanged = drvIntNetNotifyLinkChanged; -
trunk/src/VBox/Devices/Network/DrvNAT.cpp
r570 r587 97 97 } 98 98 99 100 /**101 * Send multiple data packets to the network.102 *103 * @returns VBox status code.104 * @param pInterface Pointer to the interface structure containing the called function pointer.105 * @param cPackets Number of packets106 * @param paPacket Packet description array107 * @thread EMT108 */109 static DECLCALLBACK(int) drvNATSendEx(PPDMINETWORKCONNECTOR pInterface, uint32_t cPackets, PPDMINETWORKPACKET paPacket)110 {111 int rc = VERR_INVALID_PARAMETER;112 113 for (uint32_t i = 0; i < cPackets; i++)114 {115 rc = drvNATSend(pInterface, paPacket[i].pvBuf, paPacket[i].cb);116 if (VBOX_FAILURE(rc))117 break;118 }119 return rc;120 }121 99 122 100 /** … … 378 356 /* INetwork */ 379 357 pData->INetworkConnector.pfnSend = drvNATSend; 380 pData->INetworkConnector.pfnSendEx = drvNATSendEx;381 358 pData->INetworkConnector.pfnSetPromiscuousMode = drvNATSetPromiscuousMode; 382 359 pData->INetworkConnector.pfnNotifyLinkChanged = drvNATNotifyLinkChanged; -
trunk/src/VBox/Devices/Network/DrvNetSniffer.cpp
r571 r587 147 147 148 148 /** 149 * Send multiple data packets to the network.150 *151 * @returns VBox status code.152 * @param pInterface Pointer to the interface structure containing the called function pointer.153 * @param cPackets Number of packets154 * @param paPacket Packet description array155 * @thread EMT156 */157 static DECLCALLBACK(int) drvNetSnifferSendEx(PPDMINETWORKCONNECTOR pInterface, uint32_t cPackets, PPDMINETWORKPACKET paPacket)158 {159 int rc = VERR_INVALID_PARAMETER;160 161 for (uint32_t i = 0; i < cPackets; i++)162 {163 rc = drvNetSnifferSend(pInterface, paPacket[i].pvBuf, paPacket[i].cb);164 if (VBOX_FAILURE(rc))165 break;166 }167 return rc;168 }169 170 171 /**172 149 * Set promiscuous mode. 173 150 * … … 355 332 /* INetworkConnector */ 356 333 pData->INetworkConnector.pfnSend = drvNetSnifferSend; 357 pData->INetworkConnector.pfnSendEx = drvNetSnifferSendEx;358 334 pData->INetworkConnector.pfnSetPromiscuousMode = drvNetSnifferSetPromiscuousMode; 359 335 pData->INetworkConnector.pfnNotifyLinkChanged = drvNetSnifferNotifyLinkChanged; -
trunk/src/VBox/Devices/Network/DrvTAP.cpp
r572 r587 157 157 } 158 158 159 /**160 * Send multiple data packets to the network.161 *162 * @returns VBox status code.163 * @param pInterface Pointer to the interface structure containing the called function pointer.164 * @param cPackets Number of packets165 * @param paPacket Packet description array166 * @thread EMT167 */168 static DECLCALLBACK(int) drvTAPSendEx(PPDMINETWORKCONNECTOR pInterface, uint32_t cPackets, PPDMINETWORKPACKET paPacket)169 {170 int rc = VERR_INVALID_PARAMETER;171 172 for (uint32_t i = 0; i < cPackets; i++)173 {174 rc = drvTAPSend(pInterface, paPacket[i].pvBuf, paPacket[i].cb);175 if (VBOX_FAILURE(rc))176 break;177 }178 return rc;179 }180 159 181 160 /** … … 530 509 /* INetwork */ 531 510 pData->INetworkConnector.pfnSend = drvTAPSend; 532 pData->INetworkConnector.pfnSendEx = drvTAPSendEx;533 511 pData->INetworkConnector.pfnSetPromiscuousMode = drvTAPSetPromiscuousMode; 534 512 pData->INetworkConnector.pfnNotifyLinkChanged = drvTAPNotifyLinkChanged; -
trunk/src/VBox/Devices/Network/DrvTAPWin32.cpp
r575 r587 165 165 } 166 166 167 /**168 * Send multiple data packets to the network.169 *170 * @returns VBox status code.171 * @param pInterface Pointer to the interface structure containing the called function pointer.172 * @param cPackets Number of packets173 * @param paPacket Packet description array174 * @thread EMT175 */176 static DECLCALLBACK(int) drvTAPW32SendEx(PPDMINETWORKCONNECTOR pInterface, uint32_t cPackets, PPDMINETWORKPACKET paPacket)177 {178 PDRVTAP pData = PDMINETWORKCONNECTOR_2_DRVTAP(pInterface);179 int rc = VERR_INVALID_PARAMETER;180 181 if (pData->tapVersion.minor > 1)182 {183 TAP_SCATTER_GATHER_LIST_MAX list;184 BOOL ret;185 DWORD length;186 187 list.cPackets = RT_MIN(cPackets, TAP_SCATTER_GATHER_MAX_PACKETS);188 cPackets -= list.cPackets;189 190 for (uint32_t i=0;i<list.cPackets;i++)191 {192 list.aPacket[i].pPacket = paPacket[i].pvBuf;193 list.aPacket[i].cb = paPacket[i].cb;194 }195 196 ret = DeviceIoControl(pData->hFile, TAP_IOCTL_TRANSFER_ETHPACKETS, &list, RT_OFFSETOF(TAP_SCATTER_GATHER_LIST_MAX, aPacket[list.cPackets]),197 NULL, 0, &length, NULL);198 if (ret == FALSE)199 return RTErrConvertFromWin32(GetLastError());200 201 if (cPackets)202 return drvTAPW32SendEx(pInterface, cPackets, &paPacket[list.cPackets]);203 }204 else205 {206 for (uint32_t i=0;i<cPackets;i++)207 {208 rc = drvTAPW32Send(pInterface, paPacket[i].pvBuf, paPacket[i].cb);209 if (VBOX_FAILURE(rc))210 break;211 }212 }213 return rc;214 }215 216 167 217 168 /** … … 515 466 /* INetwork */ 516 467 pData->INetworkConnector.pfnSend = drvTAPW32Send; 517 pData->INetworkConnector.pfnSendEx = drvTAPW32SendEx;518 468 pData->INetworkConnector.pfnSetPromiscuousMode = drvTAPW32SetPromiscuousMode; 519 469 pData->INetworkConnector.pfnNotifyLinkChanged = drvTAPW32NotifyLinkChanged;
Note:
See TracChangeset
for help on using the changeset viewer.