VirtualBox

Changeset 87767 in vbox for trunk/src/VBox/Devices/Network


Ignore:
Timestamp:
Feb 16, 2021 4:41:18 PM (4 years ago)
Author:
vboxsync
Message:

VMM/TM,Devices/*: Changed the device and usb timer callbacks to take a timer handle rather than a pointer. Try a little harder using it. bugref:9943

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

Legend:

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

    r87760 r87767  
    21912191            uint64_t tsNow = PDMDevHlpTimerGet(pDevIns, pThis->hIntTimer);
    21922192            if (!!ITR && tsNow - pThis->u64AckedAt < ITR * 256
    2193                      && pThis->fItrEnabled && (pThis->fItrRxEnabled || !(ICR & ICR_RXT0)))
     2193                && pThis->fItrEnabled && (pThis->fItrRxEnabled || !(ICR & ICR_RXT0)))
    21942194            {
    21952195                E1K_INC_ISTAT_CNT(pThis->uStatIntEarly);
     
    35093509# ifdef E1K_TX_DELAY
    35103510/**
    3511  * Transmit Delay Timer handler.
    3512  *
    3513  * @remarks We only get here when the timer expires.
    3514  *
    3515  * @param   pDevIns     Pointer to device instance structure.
    3516  * @param   pTimer      Pointer to the timer.
    3517  * @param   pvUser      NULL.
    3518  * @thread  EMT
    3519  */
    3520 static DECLCALLBACK(void) e1kR3TxDelayTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser)
     3511 * @callback_method_impl{FNTMTIMERDEV, Transmit Delay Timer handler.}
     3512 */
     3513static DECLCALLBACK(void) e1kR3TxDelayTimer(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, void *pvUser)
    35213514{
    35223515    PE1KSTATE pThis = (PE1KSTATE)pvUser;
    35233516    Assert(PDMCritSectIsOwner(&pThis->csTx));
     3517    RT_NOREF(hTimer);
    35243518
    35253519    E1K_INC_ISTAT_CNT(pThis->uStatTxDelayExp);
     
    35373531
    35383532/**
    3539  * Transmit Interrupt Delay Timer handler.
    3540  *
    3541  * @remarks We only get here when the timer expires.
    3542  *
    3543  * @param   pDevIns     Pointer to device instance structure.
    3544  * @param   pTimer      Pointer to the timer.
    3545  * @param   pvUser      NULL.
    3546  * @thread  EMT
    3547  */
    3548 static DECLCALLBACK(void) e1kR3TxIntDelayTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser)
    3549 {
    3550     RT_NOREF(pDevIns);
    3551     RT_NOREF(pTimer);
     3533 * @callback_method_impl{FNTMTIMERDEV, Transmit Interrupt Delay Timer handler.}
     3534 */
     3535static DECLCALLBACK(void) e1kR3TxIntDelayTimer(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, void *pvUser)
     3536{
    35523537    PE1KSTATE pThis = (PE1KSTATE)pvUser;
     3538    Assert(hTimer == pThis->hTIDTimer); RT_NOREF(hTimer);
    35533539
    35543540    E1K_INC_ISTAT_CNT(pThis->uStatTID);
     
    35613547
    35623548/**
    3563  * Transmit Absolute Delay Timer handler.
    3564  *
    3565  * @remarks We only get here when the timer expires.
    3566  *
    3567  * @param   pDevIns     Pointer to device instance structure.
    3568  * @param   pTimer      Pointer to the timer.
    3569  * @param   pvUser      NULL.
    3570  * @thread  EMT
    3571  */
    3572 static DECLCALLBACK(void) e1kR3TxAbsDelayTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser)
    3573 {
    3574     RT_NOREF(pDevIns);
    3575     RT_NOREF(pTimer);
     3549 * @callback_method_impl{FNTMTIMERDEV, Transmit Absolute Delay Timer handler.}
     3550 */
     3551static DECLCALLBACK(void) e1kR3TxAbsDelayTimer(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, void *pvUser)
     3552{
    35763553    PE1KSTATE pThis = (PE1KSTATE)pvUser;
     3554    Assert(hTimer == pThis->hTADTimer); RT_NOREF(hTimer);
    35773555
    35783556    E1K_INC_ISTAT_CNT(pThis->uStatTAD);
     
    35863564
    35873565/**
    3588  * Receive Interrupt Delay Timer handler.
    3589  *
    3590  * @remarks We only get here when the timer expires.
    3591  *
    3592  * @param   pDevIns     Pointer to device instance structure.
    3593  * @param   pTimer      Pointer to the timer.
    3594  * @param   pvUser      NULL.
    3595  * @thread  EMT
    3596  */
    3597 static DECLCALLBACK(void) e1kR3RxIntDelayTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser)
     3566 * @callback_method_impl{FNTMTIMERDEV, Receive Interrupt Delay Timer handler.}
     3567 */
     3568static DECLCALLBACK(void) e1kR3RxIntDelayTimer(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, void *pvUser)
    35983569{
    35993570    PE1KSTATE pThis = (PE1KSTATE)pvUser;
     3571    Assert(hTimer == pThis->hRIDTimer); RT_NOREF(hTimer);
    36003572
    36013573    E1K_INC_ISTAT_CNT(pThis->uStatRID);
     
    36063578
    36073579/**
    3608  * Receive Absolute Delay Timer handler.
    3609  *
    3610  * @remarks We only get here when the timer expires.
    3611  *
    3612  * @param   pDevIns     Pointer to device instance structure.
    3613  * @param   pTimer      Pointer to the timer.
    3614  * @param   pvUser      NULL.
    3615  * @thread  EMT
    3616  */
    3617 static DECLCALLBACK(void) e1kR3RxAbsDelayTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser)
     3580 * @callback_method_impl{FNTMTIMERDEV, Receive Absolute Delay Timer handler.}
     3581 */
     3582static DECLCALLBACK(void) e1kR3RxAbsDelayTimer(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, void *pvUser)
    36183583{
    36193584    PE1KSTATE pThis = (PE1KSTATE)pvUser;
     3585    Assert(hTimer == pThis->hRADTimer); RT_NOREF(hTimer);
    36203586
    36213587    E1K_INC_ISTAT_CNT(pThis->uStatRAD);
     
    36283594
    36293595/**
    3630  * Late Interrupt Timer handler.
    3631  *
    3632  * @param   pDevIns     Pointer to device instance structure.
    3633  * @param   pTimer      Pointer to the timer.
    3634  * @param   pvUser      NULL.
    3635  * @thread  EMT
    3636  */
    3637 static DECLCALLBACK(void) e1kR3LateIntTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser)
    3638 {
    3639     RT_NOREF(pDevIns, pTimer);
     3596 * @callback_method_impl{FNTMTIMERDEV, Late Interrupt Timer handler.}
     3597 */
     3598static DECLCALLBACK(void) e1kR3LateIntTimer(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, void *pvUser)
     3599{
    36403600    PE1KSTATE pThis = (PE1KSTATE)pvUser;
     3601    Assert(hTimer == pThis->hIntTimer); RT_NOREF(hTimer);
     3602    RT_NOREF(hTimer);
    36413603
    36423604    STAM_PROFILE_ADV_START(&pThis->StatLateIntTimer, a);
     
    36523614
    36533615/**
    3654  * Link Up Timer handler.
    3655  *
    3656  * @param   pDevIns     Pointer to device instance structure.
    3657  * @param   pTimer      Pointer to the timer.
    3658  * @param   pvUser      NULL.
    3659  * @thread  EMT
    3660  */
    3661 static DECLCALLBACK(void) e1kR3LinkUpTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser)
    3662 {
    3663     RT_NOREF(pTimer);
     3616 * @callback_method_impl{FNTMTIMERDEV, Link Up Timer handler.}
     3617 */
     3618static DECLCALLBACK(void) e1kR3LinkUpTimer(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, void *pvUser)
     3619{
    36643620    PE1KSTATE   pThis   = (PE1KSTATE)pvUser;
    36653621    PE1KSTATECC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PE1KSTATECC);
     3622    Assert(hTimer == pThis->hLUTimer); RT_NOREF(hTimer);
    36663623
    36673624    /*
  • trunk/src/VBox/Devices/Network/DevPCNet.cpp

    r87760 r87767  
    40094009 * @callback_method_impl{FNTMTIMERDEV, Poll timer}
    40104010 */
    4011 static DECLCALLBACK(void) pcnetR3Timer(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser)
     4011static DECLCALLBACK(void) pcnetR3Timer(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, void *pvUser)
    40124012{
    40134013    PPCNETSTATE   pThis   = PDMDEVINS_2_DATA(pDevIns, PPCNETSTATE);
    40144014    PPCNETSTATECC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PPCNETSTATECC);
    40154015    Assert(PDMDevHlpCritSectIsOwner(pDevIns, &pThis->CritSect));
    4016     RT_NOREF(pvUser, pTimer);
     4016    Assert(hTimer == pThis->hTimerPoll); RT_NOREF(pvUser, hTimer);
    40174017
    40184018    STAM_PROFILE_ADV_START(&pThis->StatTimer, a);
     
    40264026 *      Software interrupt timer callback function.}
    40274027 */
    4028 static DECLCALLBACK(void) pcnetR3TimerSoftInt(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser)
     4028static DECLCALLBACK(void) pcnetR3TimerSoftInt(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, void *pvUser)
    40294029{
    40304030    PPCNETSTATE pThis = PDMDEVINS_2_DATA(pDevIns, PPCNETSTATE);
    40314031    Assert(PDMDevHlpCritSectIsOwner(pDevIns, &pThis->CritSect));
    4032     RT_NOREF(pvUser, pTimer);
     4032    Assert(hTimer == pThis->hTimerSoftInt); RT_NOREF(pvUser, hTimer);
    40334033
    40344034    pThis->aCSR[7] |= 0x0800; /* STINT */
     
    40454045 * should be considered lost.
    40464046 */
    4047 static DECLCALLBACK(void) pcnetR3TimerRestore(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser)
     4047static DECLCALLBACK(void) pcnetR3TimerRestore(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, void *pvUser)
    40484048{
    40494049    PPCNETSTATE pThis = PDMDEVINS_2_DATA(pDevIns, PPCNETSTATE);
    4050     RT_NOREF(pTimer, pvUser);
     4050    Assert(hTimer == pThis->hTimerRestore); RT_NOREF(pvUser);
    40514051
    40524052    int rc = PDMDevHlpCritSectEnter(pDevIns, &pThis->CritSect, VERR_SEM_BUSY);
     
    40564056    if (pThis->cLinkDownReported <= PCNET_MAX_LINKDOWN_REPORTED)
    40574057    {
    4058         rc = PDMDevHlpTimerSetMillies(pDevIns, pThis->hTimerRestore, 1500);
     4058        rc = PDMDevHlpTimerSetMillies(pDevIns, hTimer, 1500);
    40594059        AssertRC(rc);
    40604060    }
  • trunk/src/VBox/Devices/Network/DevVirtioNet.cpp

    r87760 r87767  
    625625 * @callback_method_impl{FNTMTIMERDEV, Link Up Timer handler.}
    626626 */
    627 static DECLCALLBACK(void) vnetR3LinkUpTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser)
     627static DECLCALLBACK(void) vnetR3LinkUpTimer(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, void *pvUser)
    628628{
    629629    PVNETSTATE   pThis   = PDMDEVINS_2_DATA(pDevIns, PVNETSTATE);
    630630    PVNETSTATECC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PVNETSTATECC);
    631     RT_NOREF(pTimer, pvUser);
     631    RT_NOREF(hTimer, pvUser);
    632632
    633633    int rc = vnetR3CsEnter(pDevIns, pThis, VERR_SEM_BUSY);
     
    15091509 * @callback_method_impl{FNTMTIMERDEV, Transmit Delay Timer handler.}
    15101510 */
    1511 static DECLCALLBACK(void) vnetR3TxTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser)
     1511static DECLCALLBACK(void) vnetR3TxTimer(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, void *pvUser)
    15121512{
    15131513    PVNETSTATE      pThis   = PDMDEVINS_2_DATA(pDevIns, PVNETSTATE);
    15141514    PVNETSTATECC    pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PVNETSTATECC);
    1515     RT_NOREF(pTimer, pvUser);
     1515    RT_NOREF(hTimer, pvUser);
    15161516
    15171517    uint32_t u32MicroDiff = (uint32_t)((RTTimeNanoTS() - pThis->u64NanoTS) / 1000);
     
    15271527//    Log3(("%s vnetR3TxTimer: Expired\n", INSTANCE(pThis)));
    15281528    vnetR3TransmitPendingPackets(pDevIns, pThis, pThisCC, pThisCC->pTxQueue, false /*fOnWorkerThread*/);
    1529     if (RT_FAILURE(vnetR3CsEnter(pDevIns, pThis, VERR_SEM_BUSY)))
    1530     {
    1531         LogRel(("vnetR3TxTimer: Failed to enter critical section!/n"));
    1532         return;
    1533     }
     1529    int rc = vnetR3CsEnter(pDevIns, pThis, VERR_SEM_BUSY)
     1530    AssertLogRelRCReturnVoid(rc);
    15341531    vringSetNotification(pDevIns, &pThisCC->pTxQueue->VRing, true);
    15351532    vnetR3CsLeave(pDevIns, pThis);
  • trunk/src/VBox/Devices/Network/DevVirtioNet_1_0.cpp

    r87760 r87767  
    24462446 * @callback_method_impl{FNTMTIMERDEV, Link Up Timer handler.}
    24472447 */
    2448 static DECLCALLBACK(void) virtioNetR3LinkUpTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser)
     2448static DECLCALLBACK(void) virtioNetR3LinkUpTimer(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, void *pvUser)
    24492449{
    24502450    PVIRTIONET   pThis   = PDMDEVINS_2_DATA(pDevIns, PVIRTIONET);
    24512451    PVIRTIONETCC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PVIRTIONETCC);
    2452     RT_NOREF(pTimer, pvUser);
     2452    RT_NOREF(hTimer, pvUser);
    24532453
    24542454    SET_LINK_UP(pThis);
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