VirtualBox

Changeset 8610 in vbox for trunk


Ignore:
Timestamp:
May 5, 2008 8:09:26 PM (17 years ago)
Author:
vboxsync
Message:

PCNet: completed fix for broken hostif with certain guests. Make sure the PCNet poll timer is actually running if fMaybeOutOfSpace is set. Never exit the TAP recv thread if pfnWaitReceiveAvail() as this means we were woken up during a VM state transition.

Location:
trunk/src/VBox/Devices/Network
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/DevPCNet.cpp

    r8599 r8610  
    600600static int pcnetSyncTransmit(PCNetState *pData);
    601601#endif
     602static void pcnetPollTimerStart(PCNetState *pData);
    602603
    603604/**
     
    15811582    pData->aCSR[0] &= ~0x0004;       /* clear STOP bit */
    15821583    pData->aCSR[0] |=  0x0002;       /* STRT */
    1583     pcnetPollTimer(pData);           /* start timer if it was stopped */
     1584    pcnetPollTimerStart(pData);      /* start timer if it was stopped */
    15841585}
    15851586
     
    25332534
    25342535/**
    2535  * Update the poller timer
    2536  * @thread EMT,
     2536 * Start the poller timer.
     2537 * Poll timer interval is fixed to 500Hz. Don't stop it.
     2538 * @thread EMT, TAP.
     2539 */
     2540static void pcnetPollTimerStart(PCNetState *pData)
     2541{
     2542    TMTimerSet(pData->CTXSUFF(pTimerPoll),
     2543               TMTimerGet(pData->CTXSUFF(pTimerPoll))
     2544               + TMTimerFromMilli(pData->CTXSUFF(pTimerPoll), 2));
     2545}
     2546
     2547
     2548/**
     2549 * Update the poller timer.
     2550 * @thread EMT.
    25372551 */
    25382552static void pcnetPollTimer(PCNetState *pData)
     
    25692583     * disabled. We wouldn't need to poll for new TX descriptors in that case but it will
    25702584     * not hurt as waiting for RX descriptors should occur very seldom */
    2571     if (   RT_UNLIKELY(pData->fMaybeOutOfSpace)
    2572         || RT_LIKELY(!CSR_STOP(pData) && !CSR_SPND(pData) && !CSR_DPOLL(pData)))
     2585    if (RT_LIKELY(   !CSR_STOP(pData)
     2586                  && !CSR_SPND(pData)
     2587                  && (   !CSR_DPOLL(pData)
     2588                      || pData->fMaybeOutOfSpace)))
    25732589    {
    25742590        /* We ensure that we poll at least every 2ms (500Hz) but not more often than
     
    25882604        }
    25892605        if (!TMTimerIsActive(pData->CTXSUFF(pTimerPoll)))
    2590             /* Poll timer interval is fixed to 500Hz. Don't stop it. */
    2591             TMTimerSet(pData->CTXSUFF(pTimerPoll),
    2592                        TMTimerGet(pData->CTXSUFF(pTimerPoll))
    2593                        + TMTimerFromMilli(pData->CTXSUFF(pTimerPoll), 2));
     2606            pcnetPollTimerStart(pData);
    25942607#endif
    25952608    }
     
    43324345        }
    43334346        LogFlow(("pcnetWaitReceiveAvail: waiting cMillies=%u...\n", cMillies));
     4347        /* Start the poll timer once which will remain active as long fMaybeOutOfSpace
     4348         * is true -- even if (transmit) polling is disabled (CSR_DPOLL). */
     4349        rc2 = PDMCritSectEnter(&pData->CritSect, VERR_SEM_BUSY);
     4350        AssertReleaseRC(rc2);
     4351        pcnetPollTimerStart(pData);
     4352        PDMCritSectLeave(&pData->CritSect);
    43344353        RTSemEventWait(pData->hEventOutOfRxSpace, cMillies);
    43354354    }
  • trunk/src/VBox/Devices/Network/DrvTAP.cpp

    r8571 r8610  
    305305                int rc = pData->pPort->pfnWaitReceiveAvail(pData->pPort, RT_INDEFINITE_WAIT);
    306306                STAM_PROFILE_ADV_START(&pData->StatReceive, a);
     307
     308                /*
     309                 * A return code != VINF_SUCCESS means that we were woken up during a VM
     310                 * state transistion. Drop the packet and wait for the next one.
     311                 */
    307312                if (RT_FAILURE(rc))
    308                     break;
     313                    continue;
    309314
    310315                /*
  • trunk/src/VBox/Devices/Network/DrvTAPOs2.cpp

    r8155 r8610  
    256256
    257257            /*
    258              * Wait for the device to have some room.
     258             * Wait for the device to have some room. A return code != VINF_SUCCESS
     259             * means that we were woken up during a VM state transition. Drop the
     260             * current packet and wait for the next one.
    259261             */
    260262            rc = pThis->pPort->pfnWaitReceiveAvail(pThis->pPort, RT_INDEFINITE_WAIT);
    261263            if (RT_FAILURE(rc))
    262                 break;
     264                continue;
    263265
    264266            /*
  • trunk/src/VBox/Devices/Network/DrvTAPWin32.cpp

    r8155 r8610  
    225225        }
    226226
    227         /* Not very nice, but what else can we do? */
     227        /*
     228         * Wait for the device to have some room. A return code != VINF_SUCCESS
     229         * means that we were woken up during a VM state transition. Drop the
     230         * current packet and wait for the next one.
     231         */
    228232        rc = pData->pPort->pfnWaitReceiveAvail(pData->pPort, RT_INDEFINITE_WAIT);
    229233        if (RT_FAILURE(rc))
    230             break;
     234            continue;
    231235
    232236        STAM_COUNTER_INC(&pData->StatPktRecv);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette