Changeset 34102 in vbox for trunk/src/VBox/HostDrivers/VBoxNetFlt
- Timestamp:
- Nov 16, 2010 11:02:14 AM (14 years ago)
- Location:
- trunk/src/VBox/HostDrivers/VBoxNetFlt/win
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/VBoxNetFlt/win/VBoxNetFlt-win.c
r33540 r34102 2301 2301 } 2302 2302 2303 2304 2303 FINI_INTERLOCKED_SINGLE_LIST(&pAdapt->TransferDataList); 2305 2304 # if defined(DEBUG_NETFLT_LOOPBACK) || !defined(VBOX_LOOPBACK_USEFLAGS) … … 2453 2452 } 2454 2453 #endif 2455 2456 2454 /* moved to vboxNetFltOsInitInstance */ 2457 2455 } while(0); … … 3542 3540 if (pPacket) 3543 3541 { 3542 #ifdef VBOXNETADP 3544 3543 NdisMIndicateReceivePacket(pAdapt->hMiniportHandle, &pPacket, 1); 3544 #else 3545 /* flush any packets currently queued */ 3546 vboxNetFltWinPtQueueReceivedPacket(pAdapt, pPacket, TRUE /* BOOLEAN DoIndicate */); 3547 #endif 3545 3548 cRefs--; 3546 3549 #ifdef VBOXNETADP -
trunk/src/VBox/HostDrivers/VBoxNetFlt/win/VBoxNetFltCommon-win.h
r33540 r34102 334 334 #ifndef VBOXNETADP 335 335 /** true if we should indicate the receive complete used by the ProtocolReceeive mechanism */ 336 bool bIndicateRcvComplete;336 bool abIndicateRcvComplete[64]; 337 337 338 338 /** TRUE iff a request is pending at the miniport below */ … … 366 366 /** number of packets in the aReceivedPackets array*/ 367 367 ULONG cReceivedPacketCount; 368 /** flag indicating whether rx packet queueing is allowed */369 BOOLEAN bIsReceivePacketQueueingDisabled;370 368 /** packet filter flags set by the upper protocols */ 371 369 ULONG fUpperProtocolSetFilter; -
trunk/src/VBox/HostDrivers/VBoxNetFlt/win/VBoxNetFltPt-win.c
r33540 r34102 328 328 329 329 pAdapt->cReceivedPacketCount = 0; 330 /* reset the value in case */331 pAdapt->bIsReceivePacketQueueingDisabled = FALSE;332 330 ReturnPackets = TRUE; 333 331 } … … 836 834 * @return NONE 837 835 */ 838 static VOID 839 vboxNetFltWinPtQueueReceivedPacket( 836 DECLHIDDEN(VOID) vboxNetFltWinPtQueueReceivedPacket( 840 837 IN PADAPT pAdapt, 841 838 IN PNDIS_PACKET Packet, … … 849 846 RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER; 850 847 851 Assert(KeGetCurrentIrql() == DISPATCH_LEVEL);852 848 do{ 853 849 RTSpinlockAcquireNoInts(pNetFlt->hSpinlock, &Tmp); … … 878 874 */ 879 875 880 if ((pAdapt->cReceivedPacketCount == MAX_RECEIVE_PACKET_ARRAY_SIZE) || DoIndicate || bReturn 881 || pAdapt->bIsReceivePacketQueueingDisabled) 876 if ((pAdapt->cReceivedPacketCount == MAX_RECEIVE_PACKET_ARRAY_SIZE) || DoIndicate || bReturn) 882 877 { 883 878 NdisMoveMemory(PacketArray, … … 894 889 { 895 890 DoIndicate = TRUE; 896 pAdapt->bIsReceivePacketQueueingDisabled = TRUE;897 891 } 898 892 } … … 904 898 if(DoIndicate) 905 899 { 906 /* the tcp stack can send ACK packets right in the context of its PtReceive for this packet,907 * and those (tcp-sent) packets can be looped back again.908 * If this happens there is a possibility that new RX packets are received by us909 * after we do this NdisMIndicateReceivePacket and before we do a new NdisMIndicateReceivePacket910 * for the looped back tcp-sent packet.911 * If we queue those newly received packets and indicate them together with the looped back packet912 * with the latter NdisMIndicateReceivePacket, we may end up tcp stack sending ACKs in the context of its PtReceive again.913 * Thus this may lead to stack overflows on a heavy network loads.914 * To prevent this we disable the RX packet queuing when we do NdisMIndicateReceivePacket here,915 * thus if new packets arrive to us in another thread, we simply indicate them up instead of queuing them.916 * */917 Assert(pAdapt->bIsReceivePacketQueueingDisabled);918 900 NdisMIndicateReceivePacket(pAdapt->hMiniportHandle, PacketArray, NumberOfPackets); 919 RTSpinlockAcquireNoInts(pNetFlt->hSpinlock, &Tmp);920 pAdapt->bIsReceivePacketQueueingDisabled = FALSE;921 RTSpinlockReleaseNoInts(pNetFlt->hSpinlock, &Tmp);922 901 } 923 902 } … … 1820 1799 Assert(fAdaptActive); 1821 1800 1822 pAdapt->bIndicateRcvComplete = TRUE; 1823 switch (pAdapt->Medium) 1824 { 1825 case NdisMedium802_3: 1826 case NdisMediumWan: 1827 NdisMEthIndicateReceive(pAdapt->hMiniportHandle, 1828 MacReceiveContext, 1829 (PCHAR)pHeaderBuffer, 1830 cbHeaderBuffer, 1831 pLookAheadBuffer, 1832 cbLookAheadBuffer, 1833 cbPacket); 1834 break; 1835 default: 1836 Assert(FALSE); 1837 break; 1801 { 1802 ULONG Proc = KeGetCurrentProcessorNumber(); 1803 pAdapt->abIndicateRcvComplete[Proc] = TRUE; 1804 switch (pAdapt->Medium) 1805 { 1806 case NdisMedium802_3: 1807 case NdisMediumWan: 1808 NdisMEthIndicateReceive(pAdapt->hMiniportHandle, 1809 MacReceiveContext, 1810 (PCHAR)pHeaderBuffer, 1811 cbHeaderBuffer, 1812 pLookAheadBuffer, 1813 cbLookAheadBuffer, 1814 cbPacket); 1815 break; 1816 default: 1817 Assert(FALSE); 1818 break; 1819 } 1838 1820 } 1839 1821 } while(0); … … 1882 1864 bool bNetFltActive; 1883 1865 bool fAdaptActive = vboxNetFltWinReferenceAdaptNetFlt(pNetFlt, pAdapt, &bNetFltActive); 1866 ULONG Proc = KeGetCurrentProcessorNumber(); 1884 1867 1885 1868 vboxNetFltWinPtFlushReceiveQueue(pAdapt, false); … … 1887 1870 if ((pAdapt->hMiniportHandle != NULL) 1888 1871 /* && (pAdapt->MPDeviceState == NdisDeviceStateD0) */ 1889 && (pAdapt-> bIndicateRcvComplete== TRUE))1872 && (pAdapt->abIndicateRcvComplete[Proc] == TRUE)) 1890 1873 { 1891 1874 switch (pAdapt->Medium) … … 1901 1884 } 1902 1885 1903 pAdapt-> bIndicateRcvComplete= FALSE;1886 pAdapt->abIndicateRcvComplete[Proc] = FALSE; 1904 1887 1905 1888 if(fAdaptActive) -
trunk/src/VBox/HostDrivers/VBoxNetFlt/win/VBoxNetFltPt-win.h
r28800 r34102 30 30 DECLHIDDEN(NDIS_STATUS) vboxNetFltWinPtDoUnbinding(PADAPT pAdapt, bool bOnUnbind); 31 31 DECLHIDDEN(VOID) vboxNetFltWinPtFlushReceiveQueue(IN PADAPT pAdapt, IN bool bReturn); 32 DECLHIDDEN(VOID) vboxNetFltWinPtQueueReceivedPacket(IN PADAPT pAdapt, IN PNDIS_PACKET Packet, IN BOOLEAN DoIndicate); 32 33 DECLHIDDEN(VOID) vboxNetFltWinPtRequestComplete(IN NDIS_HANDLE ProtocolBindingContext, IN PNDIS_REQUEST NdisRequest, IN NDIS_STATUS Status); 33 34 DECLHIDDEN(bool) vboxNetFltWinPtCloseAdapter(PADAPT pAdapt, PNDIS_STATUS pStatus);
Note:
See TracChangeset
for help on using the changeset viewer.