VirtualBox

Changeset 28830 in vbox for trunk


Ignore:
Timestamp:
Apr 27, 2010 2:05:25 PM (15 years ago)
Author:
vboxsync
Message:

IntNet,VBoxNetFlt: Cleaned up the locking protocol between IntNet and NetFlt. Eleminated the out-bound trunk lock that IntNet always took when calling NetFlt.

Location:
trunk
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/intnet.h

    r28800 r28830  
    402402     *                      set!
    403403     *
    404      * @remarks Will only grab the switch table spinlock (interrupt safe).
     404     * @remarks Will only grab the switch table spinlock (interrupt safe).  May
     405     *          signal an event semaphore iff we're racing network cleanup.  The
     406     *          caller must be busy when calling.
    405407     */
    406408    DECLR0CALLBACKMEMBER(INTNETSWDECISION, pfnPreRecv,(PINTNETTRUNKSWPORT pSwitchPort,
     
    411413     *
    412414     * The frame may be modified when the trunk port on the switch is set to share
    413      * the mac address of the host when hitting the wire. Currently rames containing
    414      * ARP packets are subject to this, later other protocols like NDP/ICMPv6 may
    415      * need editing as well when operating in this mode.
     415     * the mac address of the host when hitting the wire.  Currently frames
     416     * containing ARP packets are subject to this, later other protocols like
     417     * NDP/ICMPv6 may need editing as well when operating in this mode.  The edited
     418     * packet should be forwarded to the host/wire when @c false is returned.
    416419     *
    417420     * @returns true if we've handled it and it should be dropped.
     
    419422     *
    420423     * @param   pSwitchPort Pointer to this structure.
    421      * @param   pSG         The (scatter /) gather structure for the frame.
    422      *                      This will only be use during the call, so a temporary one can
    423      *                      be used. The Phys member will not be used.
    424      * @param   fSrc        Where this frame comes from. Only one bit should be set!
    425      *
    426      * @remarks Will grab the network semaphore.
     424     * @param   pSG         The (scatter /) gather structure for the frame.  This
     425     *                      will only be use during the call, so a temporary one can
     426     *                      be used.  The Phys member will not be used.
     427     * @param   fSrc        Where this frame comes from.  Exactly one bit shall be
     428     *                      set!
     429     *
     430     * @remarks Will only grab the switch table spinlock (interrupt safe).  Will
     431     *          signal event semaphores.  The caller must be busy when calling.
    427432     *
    428433     * @remarks NAT and TAP will use this interface.
    429434     *
    430      * @todo    Do any of the host require notification before frame modifications? If so,
    431      *          we'll add a callback to INTNETTRUNKIFPORT for this (pfnSGModifying) and
    432      *          a SG flag.
     435     * @todo    Do any of the host require notification before frame modifications?
     436     *          If so, we'll add a callback to INTNETTRUNKIFPORT for this
     437     *          (pfnSGModifying) and a SG flag.
    433438     */
    434439    DECLR0CALLBACKMEMBER(bool, pfnRecv,(PINTNETTRUNKSWPORT pSwitchPort, PINTNETSG pSG, uint32_t fSrc));
     
    440445     * @param   pSG         Pointer to the (scatter /) gather structure.
    441446     *
    442      * @remarks Will not grab any locks.
     447     * @remarks Will not grab any locks.  The caller must be busy when calling.
    443448     */
    444449    DECLR0CALLBACKMEMBER(void, pfnSGRetain,(PINTNETTRUNKSWPORT pSwitchPort, PINTNETSG pSG));
     
    447452     * Release a SG.
    448453     *
    449      * This is called by the pfnXmit code when done with a SG. This may safe
     454     * This is called by the pfnXmit code when done with a SG.  This may safe
    450455     * be done in an asynchronous manner.
    451456     *
     
    453458     * @param   pSG         Pointer to the (scatter /) gather structure.
    454459     *
    455      * @remarks Will grab the network semaphore.
     460     * @remarks May signal an event semaphore later on, currently code won't though.
     461     *          The caller is busy when making this call.
    456462     */
    457463    DECLR0CALLBACKMEMBER(void, pfnSGRelease,(PINTNETTRUNKSWPORT pSwitchPort, PINTNETSG pSG));
     
    462468     * By enabling physical addresses in the scatter / gather segments it should
    463469     * be possible to save some unnecessary address translation and memory locking
    464      * in the network stack. (Internal networking knows the physical address for
    465      * all the INTNETBUF data and that it's locked memory.) There is a negative
     470     * in the network stack.  (Internal networking knows the physical address for
     471     * all the INTNETBUF data and that it's locked memory.)  There is a negative
    466472     * side effects though, frames that crosses page boundraries will require
    467473     * multiple scather / gather segments.
     
    472478     * @param   fEnable     Whether to enable or disable it.
    473479     *
    474      * @remarks Will grab the network semaphore.
     480     * @remarks Will not grab any locks.  The caller must be busy when calling.
    475481     */
    476482    DECLR0CALLBACKMEMBER(bool, pfnSetSGPhys,(PINTNETTRUNKSWPORT pSwitchPort, bool fEnable));
     
    485491     * @param   pMacAddr            The MAC address.
    486492     *
    487      * @remarks May take a spinlock or two.
     493     * @remarks May take a spinlock or two.  The caller must be busy when calling.
    488494     */
    489495    DECLR0CALLBACKMEMBER(void, pfnReportMacAddress,(PINTNETTRUNKSWPORT pSwitchPort, PCRTMAC pMacAddr));
     
    499505     *                              promiscuous mode, false if not.
    500506     *
    501      * @remarks May take a spinlock or two.
     507     * @remarks May take a spinlock or two.  The caller must be busy when calling.
    502508     */
    503509    DECLR0CALLBACKMEMBER(void, pfnReportPromiscuousMode,(PINTNETTRUNKSWPORT pSwitchPort, bool fPromiscuous));
     
    515521     * @param   fDst                The destination mask (INTNETTRUNKDIR_XXX).
    516522     *
    517      * @remarks Does not take any locks.
     523     * @remarks Does not take any locks.  The caller must be busy when calling.
    518524     */
    519525    DECLR0CALLBACKMEMBER(void, pfnReportGsoCapabilities,(PINTNETTRUNKSWPORT pSwitchPort, uint32_t fGsoCapabilities, uint32_t fDst));
     
    531537     * @param   fDst                The destination mask (INTNETTRUNKDIR_XXX).
    532538     *
    533      * @remarks Does not take any locks.
     539     * @remarks Does not take any locks.  The caller must be busy when calling.
    534540     */
    535541    DECLR0CALLBACKMEMBER(void, pfnReportNoPreemptDsts,(PINTNETTRUNKSWPORT pSwitchPort, uint32_t fNoPreemptDsts));
     
    543549
    544550
     551/**
     552 * The trunk interface state used set by INTNETTRUNKIFPORT::pfnSetState.
     553 */
     554typedef enum INTNETTRUNKIFSTATE
     555{
     556    /** The invalid zero entry. */
     557    INTNETTRUNKIFSTATE_INVALID = 0,
     558    /** The trunk is inactive.  No calls to INTNETTRUNKSWPORT::pfnRecv or
     559     *  INTNETTRUNKSWPORT::pfnPreRecv.  Calling other methods is OK. */
     560    INTNETTRUNKIFSTATE_INACTIVE,
     561    /** The trunk is active, no restrictions on methods or anything. */
     562    INTNETTRUNKIFSTATE_ACTIVE,
     563    /** The trunk is about to be disconnected from the internal network.  No
     564     *  calls to any INTNETRUNKSWPORT methods. */
     565    INTNETTRUNKIFSTATE_DISCONNECTING,
     566    /** The end of the valid states. */
     567    INTNETTRUNKIFSTATE_END,
     568    /** The usual 32-bit type blow up hack. */
     569    INTNETTRUNKIFSTATE_32BIT_HACK = 0x7fffffff
     570} INTNETTRUNKIFSTATE;
     571
    545572/** Pointer to the interface side of a trunk port. */
    546573typedef struct INTNETTRUNKIFPORT *PINTNETTRUNKIFPORT;
    547574/**
    548  * This is the port on the trunk interface, i.e. the driver
    549  * side which the internal network is connected to.
     575 * This is the port on the trunk interface, i.e. the driver side which the
     576 * internal network is connected to.
    550577 *
    551578 * This is only used for the in-kernel trunk connections.
    552  *
    553  * @remarks The internal network side is responsible for serializing all calls
    554  *          to this interface. This is (assumed) to be implemented using a lock
    555  *          that is only ever taken before a call to this interface. The lock
    556  *          is referred to as the out-bound trunk port lock.
    557579 */
    558580typedef struct INTNETTRUNKIFPORT
     
    568590     * @param   pIfPort     Pointer to this structure.
    569591     *
    570      * @remarks The caller may own any locks or none at all, we don't care.
     592     * @remarks May own the big mutex, no spinlocks.
    571593     */
    572594    DECLR0CALLBACKMEMBER(void, pfnRetain,(PINTNETTRUNKIFPORT pIfPort));
     
    580602     * @param   pIfPort     Pointer to this structure.
    581603     *
    582      * @remarks Only the out-bound trunk port lock, unless the caller is certain the
    583      *          call is not going to cause destruction (wont happen).
     604     * @remarks May own the big mutex, no spinlocks.
    584605     */
    585606    DECLR0CALLBACKMEMBER(void, pfnRelease,(PINTNETTRUNKIFPORT pIfPort));
     
    593614     * @param   pIfPort     Pointer to this structure.
    594615     *
    595      * @remarks Called holding the out-bound trunk port lock.
     616     * @remarks Owns the big mutex.
    596617     */
    597618    DECLR0CALLBACKMEMBER(void, pfnDisconnectAndRelease,(PINTNETTRUNKIFPORT pIfPort));
    598619
    599620    /**
    600      * Changes the active state of the interface.
    601      *
    602      * The interface is created in the suspended (non-active) state and then activated
    603      * when the VM/network is started. It may be suspended and re-activated later
    604      * for various reasons. It will finally be suspended again before disconnecting
    605      * the interface from the internal network, however, this might be done immediately
    606      * before disconnecting and may leave an incoming frame waiting on the internal network
    607      * semaphore. So, after the final suspend a pfnWaitForIdle is always called to make sure
    608      * the interface is idle before pfnDisconnectAndRelease is called.
     621     * Changes the state of the trunk interface.
     622     *
     623     * The interface is created in the inactive state (INTNETTRUNKIFSTATE_INACTIVE).
     624     * When the first connect VM or service is activated, the internal network
     625     * activates the trunk (INTNETTRUNKIFSTATE_ACTIVE).  The state may then be set
     626     * back and forth between INACTIVE and ACTIVE as VMs are paused, added and
     627     * removed.
     628     *
     629     * Eventually though, the network is destroyed as a result of there being no
     630     * more VMs left in it and the state is changed to disconnecting
     631     * (INTNETTRUNKIFSTATE_DISCONNECTING) and pfnWaitForIdle is called to make sure
     632     * there are no active calls in either direction when pfnDisconnectAndRelease is
     633     * called.
    609634     *
    610635     * A typical operation to performed by this method is to enable/disable promiscuous
    611      * mode on the host network interface. (This is the reason we cannot call this when
    612      * owning any semaphores.)
     636     * mode on the host network interface when entering/leaving the active state.
    613637     *
    614638     * @returns The previous state.
    615639     *
    616640     * @param   pIfPort     Pointer to this structure.
    617      * @param   fActive     True if the new state is 'active', false if the new state is 'suspended'.
    618      *
    619      * @remarks Called holding the out-bound trunk port lock.
    620      */
    621     DECLR0CALLBACKMEMBER(bool, pfnSetActive,(PINTNETTRUNKIFPORT pIfPort, bool fActive));
     641     * @param   enmState    The new state.
     642     *
     643     * @remarks Owns the big mutex.  No racing pfnSetState, pfnWaitForIdle,
     644     *          pfnDisconnectAndRelease or INTNETTRUNKFACTORY::pfnCreateAndConnect
     645     *          calls.
     646     */
     647    DECLR0CALLBACKMEMBER(INTNETTRUNKIFSTATE, pfnSetState,(PINTNETTRUNKIFPORT pIfPort, INTNETTRUNKIFSTATE enmState));
    622648
    623649    /**
    624650     * Waits for the interface to become idle.
    625651     *
    626      * This method must be called before disconnecting and releasing the
    627      * object in order to prevent racing incoming/outgoing frames and device
     652     * This method must be called before disconnecting and releasing the object in
     653     * order to prevent racing incoming/outgoing frames and device
    628654     * enabling/disabling.
    629655     *
     
    634660     *                      an indefinite wait.
    635661     *
    636      * @remarks Called holding the out-bound trunk port lock.
     662     * @remarks Owns the big mutex.  No racing pfnDisconnectAndRelease.
    637663     */
    638664    DECLR0CALLBACKMEMBER(int, pfnWaitForIdle,(PINTNETTRUNKIFPORT pIfPort, uint32_t cMillies));
    639 
    640     /**
    641      * Gets the MAC address of the host network interface that we're attached to.
    642      *
    643      * @param   pIfPort     Pointer to this structure.
    644      * @param   pMac        Where to store the host MAC address.
    645      *
    646      * @remarks Called while owning the network and the out-bound trunk port semaphores.
    647      */
    648     DECLR0CALLBACKMEMBER(void, pfnGetMacAddress,(PINTNETTRUNKIFPORT pIfPort, PRTMAC pMac));
    649 
    650     /**
    651      * Tests whether the host is operating the interface is promiscuous mode.
    652      *
    653      * The default behavior of the internal networking 'switch' is to 'autodetect'
    654      * promiscuous mode on the trunk port, which is when this method is used.
    655      * For security reasons this default may of course be overridden so that the
    656      * host cannot sniff at what's going on.
    657      *
    658      * Note that this differs from operating the trunk port on the switch in
    659      * 'promiscuous' mode, because that relates to the bits going to the wire.
    660      *
    661      * @returns true / false.
    662      *
    663      * @param   pIfPort     Pointer to this structure.
    664      *
    665      * @remarks Usuaully called while owning the network and the out-bound trunk
    666      *          port semaphores.
    667      */
    668     DECLR0CALLBACKMEMBER(bool, pfnIsPromiscuous,(PINTNETTRUNKIFPORT pIfPort));
    669665
    670666    /**
     
    679675     * @param   fDst        The destination mask. At least one bit will be set.
    680676     *
    681      * @remarks Called holding the out-bound trunk port lock.
    682      *
    683      * @remarks TAP and NAT will use this interface for all their traffic, see pfnIsHostMac.
    684      *
    685      * @todo
     677     * @remarks No locks.  May be called concurrently on several threads.
    686678     */
    687679    DECLR0CALLBACKMEMBER(int, pfnXmit,(PINTNETTRUNKIFPORT pIfPort, PINTNETSG pSG, uint32_t fDst));
     
    743735
    744736/** The UUID for the (current) trunk factory. (case sensitive) */
    745 #define INTNETTRUNKFACTORY_UUID_STR     "5d347cb7-98e3-411f-916a-67c4becae09b"
     737#define INTNETTRUNKFACTORY_UUID_STR     "1849823d-33ed-4f23-a32f-ef7203ee2b9f"
    746738
    747739/** @name INTNETTRUNKFACTORY::pfnCreateAndConnect flags.
  • trunk/src/VBox/HostDrivers/VBoxNetAdp/VBoxNetAdp.c

    r28800 r28830  
    3737
    3838#ifdef VBOXANETADP_DO_NOT_USE_NETFLT
     39#error "this code is broken"
    3940
    4041#include <VBox/sup.h>
     
    107108    RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
    108109    Log(("vboxNetAdpSetStateWithLock: pThis=%p, state=%d.\n", pThis, enmNewState));
    109     RTSpinlockAcquire(pThis->hSpinlock, &Tmp);
     110    RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
    110111    vboxNetAdpSetState(pThis, enmNewState);
    111     RTSpinlockRelease(pThis->hSpinlock, &Tmp);
     112    RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
    112113}
    113114
     
    125126    VBOXNETADPSTATE enmState;
    126127    RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
    127     RTSpinlockAcquire(pThis->hSpinlock, &Tmp);
     128    RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
    128129    enmState = vboxNetAdpGetState(pThis);
    129     RTSpinlockRelease(pThis->hSpinlock, &Tmp);
     130    RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
    130131    Log(("vboxNetAdpGetStateWithLock: pThis=%p, state=%d.\n", pThis, enmState));
    131132    return enmState;
     
    148149    RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
    149150
    150     RTSpinlockAcquire(pThis->hSpinlock, &Tmp);
     151    RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
    151152    enmActualState = vboxNetAdpGetState(pThis); /** @todo r=bird: ASMAtomicCmpXchgU32()*/
    152153    if (enmActualState == enmOldState)
     
    154155    else
    155156        fRc = false;
    156     RTSpinlockRelease(pThis->hSpinlock, &Tmp);
     157    RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
    157158
    158159    if (fRc)
     
    179180        RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
    180181        PVBOXNETADP pThis = &pGlobals->aAdapters[i];
    181         RTSpinlockAcquire(pThis->hSpinlock, &Tmp);
     182        RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
    182183        if (    vboxNetAdpGetState(pThis)
    183184            &&  !strcmp(pThis->szName, pszName))
    184185        {
    185             RTSpinlockRelease(pThis->hSpinlock, &Tmp);
     186            RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
    186187            return pThis;
    187188        }
    188         RTSpinlockRelease(pThis->hSpinlock, &Tmp);
     189        RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
    189190    }
    190191    return NULL;
     
    346347    AssertPtr(pThis);
    347348    Assert(pThis->MyPort.u32Version == INTNETTRUNKIFPORT_VERSION);
    348     RTSpinlockAcquire(pThis->hSpinlock, &Tmp);
     349    RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
    349350    if (vboxNetAdpGetState(pThis) == kVBoxNetAdpState_Active)
    350351    {
     
    353354        vboxNetAdpBusy(pThis);
    354355    }
    355     RTSpinlockRelease(pThis->hSpinlock, &Tmp);
     356    RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
    356357    Log(("vboxNetAdpPrepareToReceive: fCanReceive=%d.\n", fCanReceive));
    357358
     
    416417     * Do a retain/busy, invoke the OS specific code.
    417418     */
    418     RTSpinlockAcquire(pThis->hSpinlock, &Tmp);
     419    RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
    419420    if (vboxNetAdpGetState(pThis) != kVBoxNetAdpState_Active)
    420421    {
    421         RTSpinlockRelease(pThis->hSpinlock, &Tmp);
     422        RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
    422423        Log(("vboxNetAdpReceive: Dropping incoming packet for inactive interface %s.\n",
    423424             pThis->szName));
     
    426427    vboxNetAdpRetain(pThis);
    427428    vboxNetAdpBusy(pThis);
    428     RTSpinlockRelease(pThis->hSpinlock, &Tmp);
     429    RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
    429430
    430431    rc = vboxNetAdpPortOsXmit(pThis, pSG, fDst);
     
    504505
    505506    Log(("vboxNetAdpPortSetActive: pThis=%p, fActive=%d, state before: %d.\n", pThis, fActive, vboxNetAdpGetState(pThis)));
    506     RTSpinlockAcquire(pThis->hSpinlock, &Tmp);
     507    RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
    507508
    508509    fPreviouslyActive = vboxNetAdpGetState(pThis) == kVBoxNetAdpState_Active;
     
    522523    }
    523524
    524     RTSpinlockRelease(pThis->hSpinlock, &Tmp);
     525    RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
    525526    Log(("vboxNetAdpPortSetActive: state after: %RTbool.\n", vboxNetAdpGetState(pThis)));
    526527    return fPreviouslyActive;
     
    550551     * Disconnect and release it.
    551552     */
    552     RTSpinlockAcquire(pThis->hSpinlock, &Tmp);
     553    RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
    553554    //Assert(vboxNetAdpGetState(pThis) == kVBoxNetAdpState_Connected);
    554555    Assert(!pThis->cBusy);
    555556    vboxNetAdpSetState(pThis, kVBoxNetAdpState_Transitional);
    556     RTSpinlockRelease(pThis->hSpinlock, &Tmp);
     557    RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
    557558
    558559    vboxNetAdpOsDisconnectIt(pThis);
    559560    pThis->pSwitchPort = NULL;
    560561
    561     RTSpinlockAcquire(pThis->hSpinlock, &Tmp);
     562    RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
    562563    vboxNetAdpSetState(pThis, kVBoxNetAdpState_Available);
    563     RTSpinlockRelease(pThis->hSpinlock, &Tmp);
     564    RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
    564565
    565566    vboxNetAdpRelease(pThis);
     
    606607            rc = vboxNetAdpOsCreate(pThis, &Mac);
    607608            *ppNew = pThis;
    608             RTSpinlockAcquire(pThis->hSpinlock, &Tmp);
     609            RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
    609610            vboxNetAdpSetState(pThis, kVBoxNetAdpState_Available);
    610             RTSpinlockRelease(pThis->hSpinlock, &Tmp);
     611            RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
    611612            return rc;
    612613        }
     
    622623    RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
    623624
    624     RTSpinlockAcquire(pThis->hSpinlock, &Tmp);
     625    RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
    625626    if (vboxNetAdpGetState(pThis) != kVBoxNetAdpState_Available || pThis->cBusy)
    626627    {
    627         RTSpinlockRelease(pThis->hSpinlock, &Tmp);
     628        RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
    628629        return VERR_INTNET_FLT_IF_BUSY;
    629630    }
    630631    vboxNetAdpSetState(pThis, kVBoxNetAdpState_Transitional);
    631     RTSpinlockRelease(pThis->hSpinlock, &Tmp);
     632    RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
    632633    vboxNetAdpRelease(pThis);
    633634
    634635    vboxNetAdpOsDestroy(pThis);
    635636
    636     RTSpinlockAcquire(pThis->hSpinlock, &Tmp);
     637    RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
    637638    vboxNetAdpSetState(pThis, kVBoxNetAdpState_Invalid);
    638     RTSpinlockRelease(pThis->hSpinlock, &Tmp);
     639    RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
    639640
    640641    return rc;
     
    842843    pNew->MyPort.pfnRelease             = vboxNetAdpPortRelease;
    843844    pNew->MyPort.pfnDisconnectAndRelease= vboxNetAdpPortDisconnectAndRelease;
    844     pNew->MyPort.pfnSetActive           = vboxNetAdpPortSetActive;
     845    pNew->MyPort.pfnSetState            = vboxNetAdpPortSetState;
    845846    pNew->MyPort.pfnWaitForIdle         = vboxNetAdpPortWaitForIdle;
    846     pNew->MyPort.pfnGetMacAddress       = vboxNetAdpPortGetMacAddress;
    847847    pNew->MyPort.pfnXmit                = vboxNetAdpPortXmit;
    848848    pNew->MyPort.u32VersionEnd          = INTNETTRUNKIFPORT_VERSION;
  • trunk/src/VBox/HostDrivers/VBoxNetFlt/VBoxNetFltInternal.h

    r28800 r28830  
    104104    /** The current interface state. */
    105105    VBOXNETFTLINSSTATE volatile enmState;
    106     /** Active / Suspended indicator. */
     106    /** The trunk state. */
     107    INTNETTRUNKIFSTATE volatile enmTrunkState;
    107108    bool volatile fActive;
    108109    /** Disconnected from the host network interface. */
     
    325326
    326327DECLHIDDEN(void) vboxNetFltRetain(PVBOXNETFLTINS pThis, bool fBusy);
     328DECLHIDDEN(bool) vboxNetFltTryRetainBusyActive(PVBOXNETFLTINS pThis);
     329DECLHIDDEN(bool) vboxNetFltTryRetainBusyNotDisconnected(PVBOXNETFLTINS pThis);
    327330DECLHIDDEN(void) vboxNetFltRelease(PVBOXNETFLTINS pThis, bool fBusy);
    328331
  • trunk/src/VBox/HostDrivers/VBoxNetFlt/darwin/VBoxNetFlt-darwin.cpp

    r28800 r28830  
    233233     * Be careful here to avoid problems racing the detached callback.
    234234     */
    235     RTSpinlockAcquire(pThis->hSpinlock, &Tmp);
     235    RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
    236236    if (!ASMAtomicUoReadBool(&pThis->fDisconnectedFromHost))
    237237    {
     
    240240            ifnet_reference(pIfNet);
    241241    }
    242     RTSpinlockRelease(pThis->hSpinlock, &Tmp);
     242    RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
    243243
    244244    return pIfNet;
     
    664664     * behind it in order to avoid problematic races with the detached callback.
    665665     */
    666     RTSpinlockAcquire(pThis->hSpinlock, &Tmp);
     666    RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
    667667
    668668    pIfNet = (ifnet_t)ASMAtomicUoReadPtr((void * volatile *)&pThis->u.s.pIfNet);
     
    677677    ASMAtomicWriteBool(&pThis->fDisconnectedFromHost, true);
    678678
    679     RTSpinlockRelease(pThis->hSpinlock, &Tmp);
     679    RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
    680680
    681681    if (pIfNet)
     
    817817     * Active? Retain the instance and increment the busy counter.
    818818     */
    819     RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
    820     RTSpinlockAcquire(pThis->hSpinlock, &Tmp);
    821     const bool fActive = ASMAtomicUoReadBool(&pThis->fActive);
    822     if (fActive)
    823         vboxNetFltRetain(pThis, true /* fBusy */);
    824     RTSpinlockRelease(pThis->hSpinlock, &Tmp);
    825     if (!fActive)
     819    if (!vboxNetFltTryRetainBusyActive(pThis))
    826820        return 0;
    827821
     
    919913
    920914    RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
    921     RTSpinlockAcquire(pThis->hSpinlock, &Tmp);
     915    RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
    922916    ASMAtomicUoWritePtr((void * volatile *)&pThis->u.s.pIfNet, pIfNet);
    923     RTSpinlockRelease(pThis->hSpinlock, &Tmp);
     917    RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
    924918
    925919    /*
     
    945939        Assert(err || pIfFilter);
    946940
    947         RTSpinlockAcquire(pThis->hSpinlock, &Tmp);
     941        RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
    948942        pIfNet = (ifnet_t)ASMAtomicUoReadPtr((void * volatile *)&pThis->u.s.pIfNet);
    949943        if (pIfNet && !err)
     
    953947            pIfNet = NULL; /* don't dereference it */
    954948        }
    955         RTSpinlockRelease(pThis->hSpinlock, &Tmp);
     949        RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
    956950
    957951        /* Report capabilities. */
    958         if (!pIfNet)
     952        if (   !pIfNet
     953            && vboxNetFltTryRetainBusyNotDisconnected(pThis))
    959954        {
    960955            Assert(pThis->pSwitchPort);
     
    963958            pThis->pSwitchPort->pfnReportGsoCapabilities(pThis->pSwitchPort, 0,  INTNETTRUNKDIR_WIRE | INTNETTRUNKDIR_HOST);
    964959            pThis->pSwitchPort->pfnReportNoPreemptDsts(pThis->pSwitchPort, 0 /* none */);
     960            vboxNetFltRelease(pThis, true /*fBusy*/);
    965961        }
    966962    }
     
    11631159     * Carefully obtain the interface filter reference and detach it.
    11641160     */
    1165     RTSpinlockAcquire(pThis->hSpinlock, &Tmp);
     1161    RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
    11661162    pIfFilter = (interface_filter_t)ASMAtomicUoReadPtr((void * volatile *)&pThis->u.s.pIfFilter);
    11671163    if (pIfFilter)
    11681164        ASMAtomicUoWritePtr((void * volatile *)&pThis->u.s.pIfFilter, NULL);
    1169     RTSpinlockRelease(pThis->hSpinlock, &Tmp);
     1165    RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
    11701166
    11711167    if (pIfFilter)
  • trunk/src/VBox/HostDrivers/VBoxNetFlt/freebsd/VBoxNetFlt-freebsd.c

    r28723 r28830  
    316316    bool fActive;
    317317
    318     fActive = ASMAtomicUoReadBool(&pThis->fActive);
     318    fActive = vboxNetFltTryRetainBusyActive(pThis);
    319319
    320320    NGI_GET_M(item, m);
     
    338338        {
    339339            ether_demux(ifp, m);
     340            if (fActive)
     341                vboxNetFltRelease(pThis, true /*fBusy*/);
    340342            return (0);
    341343        }
     
    345347        taskqueue_enqueue_fast(taskqueue_fast, &pThis->u.s.tskin);
    346348    }
    347     /**
     349    /*
    348350     * Handle mbufs on the outgoing hook, frames going to the interface
    349351     */
     
    351353    {
    352354        if (mtag != NULL || !fActive)
    353             return ether_output_frame(ifp, m);
     355        {
     356            int rc = ether_output_frame(ifp, m);
     357            if (fActive)
     358                vboxNetFltRelease(pThis, true /*fBusy*/);
     359            return rc;
     360        }
    354361        mtx_lock_spin(&pThis->u.s.outq.ifq_mtx);
    355362        _IF_ENQUEUE(&pThis->u.s.outq, m);
     
    361368        m_freem(m);
    362369    }
     370
     371    if (fActive)
     372        vboxNetFltRelease(pThis, true /*fBusy*/);
    363373    return (0);
    364374}
     
    370380
    371381    /* Prevent node shutdown if we're active */
    372     fActive = ASMAtomicUoReadBool(&pThis->fActive);
    373     if (fActive)
     382    if (pThis->enmTrunkState == INTNETTRUNKIFSTATE_ACTIVE)
    374383        return (EBUSY);
    375384    NG_NODE_UNREF(node);
     
    548557        return VERR_INTERNAL_ERROR;
    549558
    550     RTSpinlockAcquire(pThis->hSpinlock, &Tmp);
     559    RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
     560
    551561    ASMAtomicUoWritePtr((void * volatile *)&pThis->u.s.ifp, ifp);
    552562    pThis->u.s.node = node;
     
    564574    TASK_INIT(&pThis->u.s.tskout, 0, vboxNetFltFreeBSDoutput, pThis);
    565575
    566     RTSpinlockRelease(pThis->hSpinlock, &Tmp);
     576    RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
    567577
    568578    NG_NODE_SET_PRIVATE(node, pThis);
     
    575585    /** @todo keep these reports up to date, either by polling for changes or
    576586     *        intercept some control flow if possible. */
    577     Assert(pThis->pSwitchPort);
    578     pThis->pSwitchPort->pfnReportMacAddress(pThis->pSwitchPort, &pThis->u.s.MacAddr);
    579     pThis->pSwitchPort->pfnReportPromiscuousMode(pThis->pSwitchPort, vboxNetFltFreeBsdIsPromiscuous(pThis));
    580     pThis->pSwitchPort->pfnReportGsoCapabilities(pThis->pSwitchPort, 0, INTNETTRUNKDIR_WIRE | INTNETTRUNKDIR_HOST);
    581     pThis->pSwitchPort->pfnReportNoPreemptDsts(pThis->pSwitchPort, 0 /* none */);
     587    if (vboxNetFltTryRetainBusyNotDisconnected(pThis))
     588    {
     589        Assert(pThis->pSwitchPort);
     590        pThis->pSwitchPort->pfnReportMacAddress(pThis->pSwitchPort, &pThis->u.s.MacAddr);
     591        pThis->pSwitchPort->pfnReportPromiscuousMode(pThis->pSwitchPort, vboxNetFltFreeBsdIsPromiscuous(pThis));
     592        pThis->pSwitchPort->pfnReportGsoCapabilities(pThis->pSwitchPort, 0, INTNETTRUNKDIR_WIRE | INTNETTRUNKDIR_HOST);
     593        pThis->pSwitchPort->pfnReportNoPreemptDsts(pThis->pSwitchPort, 0 /* none */);
     594        vboxNetFltRelease(pThis, true /*fBusy*/);
     595    }
    582596
    583597    return VINF_SUCCESS;
  • trunk/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c

    r28800 r28830  
    351351    pOverride->pVBoxNetFlt          = pThis;
    352352
    353     RTSpinlockAcquire(pThis->hSpinlock, &Tmp); /* (this isn't necessary, but so what) */
     353    RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp); /* (this isn't necessary, but so what) */
    354354    ASMAtomicXchgPtr((void * volatile *)&pDev->netdev_ops, pOverride);
    355     RTSpinlockRelease(pThis->hSpinlock, &Tmp);
     355    RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
    356356}
    357357
     
    368368    RTSPINLOCKTMP               Tmp = RTSPINLOCKTMP_INITIALIZER;
    369369
    370     RTSpinlockAcquire(pThis->hSpinlock, &Tmp);
     370    RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
    371371    if (!pDev)
    372372        pDev = (struct net_device *)ASMAtomicUoReadPtr((void * volatile *)&pThis->u.s.pDev);
     
    387387    else
    388388        pOverride = NULL;
    389     RTSpinlockRelease(pThis->hSpinlock, &Tmp);
     389    RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
    390390
    391391    if (pOverride)
     
    12161216{
    12171217    PVBOXNETFLTINS  pThis   = VBOX_FLT_XT_TO_INST(pWork);
    1218     RTSPINLOCKTMP   Tmp     = RTSPINLOCKTMP_INITIALIZER;
    12191218    struct sk_buff *pBuf;
    12201219
     
    12241223     * Active? Retain the instance and increment the busy counter.
    12251224     */
    1226     RTSpinlockAcquire(pThis->hSpinlock, &Tmp);
    1227     if (ASMAtomicUoReadBool(&pThis->fActive))
    1228     {
    1229         vboxNetFltRetain(pThis, true /* fBusy */);
    1230         RTSpinlockRelease(pThis->hSpinlock, &Tmp);
    1231 
     1225    if (vboxNetFltTryRetainBusyActive(pThis))
     1226    {
    12321227        while ((pBuf = skb_dequeue(&pThis->u.s.XmitQueue)) != NULL)
    12331228            vboxNetFltLinuxForwardToIntNet(pThis, pBuf);
     
    12371232    else
    12381233    {
    1239         RTSpinlockRelease(pThis->hSpinlock, &Tmp);
    12401234        /** @todo Shouldn't we just drop the packets here? There is little point in
    12411235         *        making them accumulate when the VM is paused and it'll only waste
     
    12561250{
    12571251#ifdef VBOXNETFLT_WITH_GSO_XMIT_WIRE
    1258     struct net_device  *pDev;
    1259     PINTNETTRUNKSWPORT  pSwitchPort;
    1260     unsigned int        fFeatures;
    1261     RTSPINLOCKTMP       Tmp = RTSPINLOCKTMP_INITIALIZER;
    1262 
    1263     RTSpinlockAcquire(pThis->hSpinlock, &Tmp);
    1264 
    1265     pSwitchPort = pThis->pSwitchPort; /* this doesn't need to be here, but it doesn't harm. */
    1266     pDev = (struct net_device *)ASMAtomicUoReadPtr((void * volatile *)&pThis->u.s.pDev);
    1267     if (pDev)
    1268         fFeatures = pDev->features;
    1269     else
    1270         fFeatures = 0;
    1271 
    1272     RTSpinlockRelease(pThis->hSpinlock, &Tmp);
    1273 
    1274     if (pThis->pSwitchPort)
    1275     {
    1276         /* Set/update the GSO capabilities of the NIC. */
    1277         uint32_t fGsoCapabilites = 0;
    1278         if (fFeatures & NETIF_F_TSO)
    1279             fGsoCapabilites |= RT_BIT_32(PDMNETWORKGSOTYPE_IPV4_TCP);
    1280         if (fFeatures & NETIF_F_TSO6)
    1281             fGsoCapabilites |= RT_BIT_32(PDMNETWORKGSOTYPE_IPV6_TCP);
     1252    if (vboxNetFltTryRetainBusyNotDisconnected(pThis))
     1253    {
     1254        struct net_device  *pDev;
     1255        PINTNETTRUNKSWPORT  pSwitchPort;
     1256        unsigned int        fFeatures;
     1257        RTSPINLOCKTMP       Tmp = RTSPINLOCKTMP_INITIALIZER;
     1258
     1259        RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
     1260
     1261        pSwitchPort = pThis->pSwitchPort; /* this doesn't need to be here, but it doesn't harm. */
     1262        pDev = (struct net_device *)ASMAtomicUoReadPtr((void * volatile *)&pThis->u.s.pDev);
     1263        if (pDev)
     1264            fFeatures = pDev->features;
     1265        else
     1266            fFeatures = 0;
     1267
     1268        RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
     1269
     1270        if (pThis->pSwitchPort)
     1271        {
     1272            /* Set/update the GSO capabilities of the NIC. */
     1273            uint32_t fGsoCapabilites = 0;
     1274            if (fFeatures & NETIF_F_TSO)
     1275                fGsoCapabilites |= RT_BIT_32(PDMNETWORKGSOTYPE_IPV4_TCP);
     1276            if (fFeatures & NETIF_F_TSO6)
     1277                fGsoCapabilites |= RT_BIT_32(PDMNETWORKGSOTYPE_IPV6_TCP);
    12821278# if 0 /** @todo GSO: Test UDP offloading (UFO) on linux. */
    1283         if (fFeatures & NETIF_F_UFO)
    1284             fGsoCapabilites |= RT_BIT_32(PDMNETWORKGSOTYPE_IPV4_UDP);
    1285         if (fFeatures & NETIF_F_UFO)
    1286             fGsoCapabilites |= RT_BIT_32(PDMNETWORKGSOTYPE_IPV6_UDP);
     1279            if (fFeatures & NETIF_F_UFO)
     1280                fGsoCapabilites |= RT_BIT_32(PDMNETWORKGSOTYPE_IPV4_UDP);
     1281            if (fFeatures & NETIF_F_UFO)
     1282                fGsoCapabilites |= RT_BIT_32(PDMNETWORKGSOTYPE_IPV6_UDP);
    12871283# endif
    1288         pThis->pSwitchPort->pfnReportGsoCapabilities(pThis->pSwitchPort, fGsoCapabilites, INTNETTRUNKDIR_WIRE);
     1284            pThis->pSwitchPort->pfnReportGsoCapabilities(pThis->pSwitchPort, fGsoCapabilites, INTNETTRUNKDIR_WIRE);
     1285        }
     1286
     1287        vboxNetFltRelease(pThis, true /*fBusy*/);
    12891288    }
    12901289#endif /* VBOXNETFLT_WITH_GSO_XMIT_WIRE */
     
    13271326    dev_hold(pDev);
    13281327
    1329     RTSpinlockAcquire(pThis->hSpinlock, &Tmp);
     1328    RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
    13301329    ASMAtomicUoWritePtr((void * volatile *)&pThis->u.s.pDev, pDev);
    1331     RTSpinlockRelease(pThis->hSpinlock, &Tmp);
     1330    RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
    13321331
    13331332    Log(("vboxNetFltLinuxAttachToInterface: Device %p(%s) retained. ref=%d\n", pDev, pDev->name, atomic_read(&pDev->refcnt)));
     
    13531352     * the device notification handle.
    13541353     */
    1355     RTSpinlockAcquire(pThis->hSpinlock, &Tmp);
     1354    RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
    13561355    pDev = (struct net_device *)ASMAtomicUoReadPtr((void * volatile *)&pThis->u.s.pDev);
    13571356    if (pDev)
     
    13611360        pDev = NULL; /* don't dereference it */
    13621361    }
    1363     RTSpinlockRelease(pThis->hSpinlock, &Tmp);
     1362    RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
    13641363    Log(("vboxNetFltLinuxAttachToInterface: this=%p: Packet handler installed.\n", pThis));
    13651364
     
    13711370    {
    13721371        Assert(pThis->pSwitchPort);
    1373         vboxNetFltLinuxReportNicGsoCapabilities(pThis);
    1374         pThis->pSwitchPort->pfnReportMacAddress(pThis->pSwitchPort, &pThis->u.s.MacAddr);
    1375         pThis->pSwitchPort->pfnReportPromiscuousMode(pThis->pSwitchPort, vboxNetFltLinuxPromiscuous(pThis));
    1376         pThis->pSwitchPort->pfnReportNoPreemptDsts(pThis->pSwitchPort, INTNETTRUNKDIR_WIRE | INTNETTRUNKDIR_HOST);
     1372        if (vboxNetFltTryRetainBusyNotDisconnected(pThis))
     1373        {
     1374            vboxNetFltLinuxReportNicGsoCapabilities(pThis);
     1375            pThis->pSwitchPort->pfnReportMacAddress(pThis->pSwitchPort, &pThis->u.s.MacAddr);
     1376            pThis->pSwitchPort->pfnReportPromiscuousMode(pThis->pSwitchPort, vboxNetFltLinuxPromiscuous(pThis));
     1377            pThis->pSwitchPort->pfnReportNoPreemptDsts(pThis->pSwitchPort, INTNETTRUNKDIR_WIRE | INTNETTRUNKDIR_HOST);
     1378            vboxNetFltRelease(pThis, true /*fBusy*/);
     1379        }
    13771380    }
    13781381    else
     
    13811384        vboxNetFltLinuxUnhookDev(pThis, pDev);
    13821385#endif
    1383         RTSpinlockAcquire(pThis->hSpinlock, &Tmp);
     1386        RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
    13841387        ASMAtomicUoWritePtr((void * volatile *)&pThis->u.s.pDev, NULL);
    1385         RTSpinlockRelease(pThis->hSpinlock, &Tmp);
     1388        RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
    13861389        dev_put(pDev);
    13871390        Log(("vboxNetFltLinuxAttachToInterface: Device %p(%s) released. ref=%d\n", pDev, pDev->name, atomic_read(&pDev->refcnt)));
     
    14031406#endif
    14041407
    1405     RTSpinlockAcquire(pThis->hSpinlock, &Tmp);
     1408    RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
    14061409    ASMAtomicWriteBool(&pThis->u.s.fRegistered, false);
    14071410    ASMAtomicWriteBool(&pThis->fDisconnectedFromHost, true);
    14081411    ASMAtomicUoWritePtr((void * volatile *)&pThis->u.s.pDev, NULL);
    1409     RTSpinlockRelease(pThis->hSpinlock, &Tmp);
     1412    RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
    14101413
    14111414    dev_remove_pack(&pThis->u.s.PacketType);
     
    14231426{
    14241427    /* Check if we are not suspended and promiscuous mode has not been set. */
    1425     if (ASMAtomicUoReadBool(&pThis->fActive) && !ASMAtomicUoReadBool(&pThis->u.s.fPromiscuousSet))
     1428    if (   pThis->enmTrunkState == INTNETTRUNKIFSTATE_ACTIVE
     1429        && !ASMAtomicUoReadBool(&pThis->u.s.fPromiscuousSet))
    14261430    {
    14271431        /* Note that there is no need for locking as the kernel got hold of the lock already. */
     
    16591663    /*
    16601664     * Report the GSO capabilities of the host and device (if connected).
     1665     * Note! No need to mark ourselves busy here.
    16611666     */
    16621667    /** @todo duplicate work here now? Attach */
     
    16941699     *        ways. */
    16951700
    1696     RTSpinlockAcquire(pThis->hSpinlock, &Tmp);
     1701    RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
    16971702    pDev = (struct net_device *)ASMAtomicUoReadPtr((void * volatile *)&pThis->u.s.pDev);
    16981703    fRegistered = ASMAtomicUoReadBool(&pThis->u.s.fRegistered);
    1699     RTSpinlockRelease(pThis->hSpinlock, &Tmp);
     1704    RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
    17001705
    17011706    if (fRegistered)
  • trunk/src/VBox/HostDrivers/VBoxNetFlt/solaris/VBoxNetFlt-solaris.c

    r28800 r28830  
    995995             */
    996996            RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
    997             RTSpinlockAcquire(pThis->hSpinlock, &Tmp);
    998             const bool fActive = ASMAtomicUoReadBool(&pThis->fActive);
     997            RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
     998            const bool fActive = pThis->enmTrunkState == INTNETTRUNKIFSTATE_ACTIVE;
    999999            vboxNetFltRetain(pThis, true /* fBusy */);
    1000             RTSpinlockRelease(pThis->hSpinlock, &Tmp);
     1000            RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
    10011001
    10021002            vboxnetflt_promisc_stream_t *pPromiscStream = (vboxnetflt_promisc_stream_t *)pStream;
     
    10601060                                case DL_NOTE_LINK_UP:
    10611061                                {
    1062                                     const bool fDisconnected = ASMAtomicUoReadBool(&pThis->fActive);
    1063                                     if (fDisconnected)
    1064                                     {
    1065                                         ASMAtomicWriteBool(&pThis->fDisconnectedFromHost, false);
     1062                                    if (ASMAtomicXchgBool(&pThis->fDisconnectedFromHost, false))
    10661063                                        LogFlow((DEVICE_NAME ":VBoxNetFltSolarisModReadPut: DL_NOTE_LINK_UP.\n"));
    1067                                     }
    10681064                                    break;
    10691065                                }
     
    10711067                                case DL_NOTE_LINK_DOWN:
    10721068                                {
    1073                                     const bool fDisconnected = ASMAtomicUoReadBool(&pThis->fActive);
    1074                                     if (!fDisconnected)
    1075                                     {
    1076                                         ASMAtomicWriteBool(&pThis->fDisconnectedFromHost, true);
     1069                                    if (!ASMAtomicXchgBool(&pThis->fDisconnectedFromHost, true))
    10771070                                        LogFlow((DEVICE_NAME ":VBoxNetFltSolarisModReadPut: DL_NOTE_LINK_DOWN.\n"));
    1078                                     }
    10791071                                    break;
    10801072                                }
     
    13841376                 sizeof(pThis->u.s.MacAddr), &pThis->u.s.MacAddr));
    13851377
    1386         vboxNetFltRetain(pThis, true /*fBusy*/);
    1387         Assert(pThis->pSwitchPort);
    1388         if (pThis->pSwitchPort)
    1389             pThis->pSwitchPort->pfnReportMacAddress(pThis->pSwitchPort, &pThis->u.s.MacAddr);
    1390         vboxNetFltRelease(pThis, true /*fBusy*/);
     1378        if (vboxNetFltTryRetainBusyNotDisconnected(pThis))
     1379        {
     1380            Assert(pThis->pSwitchPort);
     1381            if (pThis->pSwitchPort)
     1382                pThis->pSwitchPort->pfnReportMacAddress(pThis->pSwitchPort, &pThis->u.s.MacAddr);
     1383            vboxNetFltRelease(pThis, true /*fBusy*/);
     1384        }
    13911385    }
    13921386    else
     
    26112605             * Report promiscuousness and capabilities.
    26122606             */
    2613             Assert(pThis->pSwitchPort);
    2614             /** @todo There is no easy way of obtaining the global host side promiscuous
    2615              * counter. Currently we just return false.  */
    2616             pThis->pSwitchPort->pfnReportPromiscuousMode(pThis->pSwitchPort, false);
    2617             pThis->pSwitchPort->pfnReportGsoCapabilities(pThis->pSwitchPort, 0,  INTNETTRUNKDIR_WIRE | INTNETTRUNKDIR_HOST);
    2618             pThis->pSwitchPort->pfnReportNoPreemptDsts(pThis->pSwitchPort, 0 /* none */);
     2607            if (vboxNetFltTryRetainBusyNotDisconnected(pThis))
     2608            {
     2609                Assert(pThis->pSwitchPort);
     2610                /** @todo There is no easy way of obtaining the global host side promiscuous
     2611                 * counter. Currently we just return false.  */
     2612                pThis->pSwitchPort->pfnReportPromiscuousMode(pThis->pSwitchPort, false);
     2613                pThis->pSwitchPort->pfnReportGsoCapabilities(pThis->pSwitchPort, 0,  INTNETTRUNKDIR_WIRE | INTNETTRUNKDIR_HOST);
     2614                pThis->pSwitchPort->pfnReportNoPreemptDsts(pThis->pSwitchPort, 0 /* none */);
     2615                vboxNetFltRelease(pThis, true /*fBusy*/);
     2616            }
    26192617
    26202618            /*
  • trunk/src/VBox/HostDrivers/VBoxNetFlt/solaris/VBoxNetFltBow-solaris.c

    r28800 r28830  
    619619     * Active? Retain the instance and increment the busy counter.
    620620     */
    621     RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
    622     RTSpinlockAcquire(pThis->hSpinlock, &Tmp);
    623     const bool fActive = ASMAtomicUoReadBool(&pThis->fActive);
    624     if (fActive)
    625         vboxNetFltRetain(pThis, true /* fBusy */);
    626     RTSpinlockRelease(pThis->hSpinlock, &Tmp);
    627     if (!fActive)
     621    if (!vboxNetFltTryRetainBusyActive(pThis))
    628622        return;
    629623
     
    840834                             * Report MAC address, promiscuous mode and capabilities.
    841835                             */
    842                             Assert(pThis->pSwitchPort);
    843                             pThis->pSwitchPort->pfnReportMacAddress(pThis->pSwitchPort, &pThis->u.s.MacAddr);
    844                             pThis->pSwitchPort->pfnReportPromiscuousMode(pThis->pSwitchPort, false); /** @todo Promisc */
    845                             pThis->pSwitchPort->pfnReportGsoCapabilities(pThis->pSwitchPort, 0, INTNETTRUNKDIR_WIRE | INTNETTRUNKDIR_HOST);
    846                             pThis->pSwitchPort->pfnReportNoPreemptDsts(pThis->pSwitchPort, 0 /* none */);
     836                            if (vboxNetFltTryRetainBusyNotDisconnected(pThis))
     837                            {
     838                                Assert(pThis->pSwitchPort);
     839                                pThis->pSwitchPort->pfnReportMacAddress(pThis->pSwitchPort, &pThis->u.s.MacAddr);
     840                                pThis->pSwitchPort->pfnReportPromiscuousMode(pThis->pSwitchPort, false); /** @todo Promisc */
     841                                pThis->pSwitchPort->pfnReportGsoCapabilities(pThis->pSwitchPort, 0, INTNETTRUNKDIR_WIRE | INTNETTRUNKDIR_HOST);
     842                                pThis->pSwitchPort->pfnReportNoPreemptDsts(pThis->pSwitchPort, 0 /* none */);
     843                                vboxNetFltRelease(pThis, true /*fBusy*/);
     844                            }
    847845
    848846                            LogFlow((DEVICE_NAME ":vboxNetFltSolarisAttachToInterface successfully attached over '%s'\n", pThis->szName));
  • trunk/src/VBox/HostDrivers/VBoxNetFlt/win/VBoxNetFlt-win.c

    r28800 r28830  
    11121112
    11131113    /* using the pPacketQueueSG as an indicator that the packet queue is initialized */
    1114     RTSpinlockAcquire((pInstance)->hSpinlock, &Tmp);
     1114    RTSpinlockAcquireNoInts((pInstance)->hSpinlock, &Tmp);
    11151115    if(pWorker->pSG)
    11161116    {
    11171117        pSG = pWorker->pSG;
    11181118        pWorker->pSG = NULL;
    1119         RTSpinlockRelease((pInstance)->hSpinlock, &Tmp);
     1119        RTSpinlockReleaseNoInts((pInstance)->hSpinlock, &Tmp);
    11201120        KeSetEvent(&pWorker->KillEvent, 0, FALSE);
    11211121
     
    11311131    else
    11321132    {
    1133         RTSpinlockRelease((pInstance)->hSpinlock, &Tmp);
     1133        RTSpinlockReleaseNoInts((pInstance)->hSpinlock, &Tmp);
    11341134    }
    11351135}
     
    30233023    Assert(pThis->fDisconnectedFromHost);
    30243024    Assert(!pThis->fRediscoveryPending);
    3025     Assert(!pThis->fActive);
     3025    Assert(pThis->enmTrunkState != INTNETTRUNKIFSTATE_ACTIVE);
    30263026#ifndef VBOXNETADP
    30273027    Assert(pAdapt->PTState.OpState == kVBoxNetDevOpState_Deinitialized);
     
    32553255//#endif
    32563256
    3257                             RTSpinlockAcquire(pThis->hSpinlock, &Tmp);
    32583257
    32593258                            /* 4. mark as connected */
     3259                            RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
    32603260                            ASMAtomicUoWriteBool(&pThis->fDisconnectedFromHost, false);
    3261 
    3262                             RTSpinlockRelease(pThis->hSpinlock, &Tmp);
     3261                            RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
    32633262
    32643263                            pAttachInfo->Status = VINF_SUCCESS;
     
    32713270                            /* 5. Report MAC address, promiscuousness and GSO capabilities. */
    32723271                            /** @todo Keep these up to date, esp. the promiscuous mode bit. */
    3273                             if (pThis->pSwitchPort)
     3272                            if (   pThis->pSwitchPort
     3273                                && vboxNetFltTryRetainBusyNotDisconnected(pThis))
    32743274                            {
    32753275                                pThis->pSwitchPort->pfnReportMacAddress(pThis->pSwitchPort, &pThis->u.s.MacAddr);
     
    32803280                                /** @todo We should be able to do pfnXmit at DISPATCH_LEVEL... */
    32813281                                pThis->pSwitchPort->pfnReportNoPreemptDsts(pThis->pSwitchPort, 0 /* none */);
     3282                                vboxNetFltRelease(pThis, true /*fBusy*/);
    32823283                            }
    32833284                            return;
  • trunk/src/VBox/HostDrivers/VBoxNetFlt/win/VBoxNetFlt-win.h

    r28800 r28830  
    636636    pNetFlt = PADAPT_2_PVBOXNETFLTINS(pAdapt);
    637637
    638     RTSpinlockAcquire((pNetFlt)->hSpinlock, &Tmp);
    639     if(!ASMAtomicUoReadBool(&(pNetFlt)->fActive))
    640     {
    641         RTSpinlockRelease((pNetFlt)->hSpinlock, &Tmp);
     638    RTSpinlockAcquireNoInts((pNetFlt)->hSpinlock, &Tmp);
     639    if(pNetFlt->enmTrunkState != INTNETTRUNKIFSTATE_ACTIVE)
     640    {
     641        RTSpinlockReleaseNoInts((pNetFlt)->hSpinlock, &Tmp);
    642642        return NULL;
    643643    }
     
    645645    if(!vboxNetFltWinDoReferenceDevice(pAdapt, &pAdapt->PTState))
    646646    {
    647         RTSpinlockRelease((pNetFlt)->hSpinlock, &Tmp);
     647        RTSpinlockReleaseNoInts((pNetFlt)->hSpinlock, &Tmp);
    648648        return NULL;
    649649    }
     
    651651    vboxNetFltRetain((pNetFlt), true /* fBusy */);
    652652
    653     RTSpinlockRelease((pNetFlt)->hSpinlock, &Tmp);
     653    RTSpinlockReleaseNoInts((pNetFlt)->hSpinlock, &Tmp);
    654654
    655655    return pNetFlt;
     
    660660    RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
    661661
    662     RTSpinlockAcquire((pNetFlt)->hSpinlock, &Tmp);
     662    RTSpinlockAcquireNoInts((pNetFlt)->hSpinlock, &Tmp);
    663663#ifndef VBOXNETADP
    664664    if(!vboxNetFltWinDoReferenceDevices(pAdapt, &pAdapt->MPState, &pAdapt->PTState))
     
    667667#endif
    668668    {
    669         RTSpinlockRelease((pNetFlt)->hSpinlock, &Tmp);
     669        RTSpinlockReleaseNoInts((pNetFlt)->hSpinlock, &Tmp);
    670670        *pbNetFltActive = false;
    671671        return false;
    672672    }
    673673
    674     if(!ASMAtomicUoReadBool(&(pNetFlt)->fActive))
     674    if(pNetFlt->enmTrunkState != INTNETTRUNKIFSTATE_ACTIVE)
    675675    {
    676676        vboxNetFltWinReferenceModePassThru(pNetFlt);
    677         RTSpinlockRelease((pNetFlt)->hSpinlock, &Tmp);
     677        RTSpinlockReleaseNoInts((pNetFlt)->hSpinlock, &Tmp);
    678678        *pbNetFltActive = false;
    679679        return true;
     
    682682    vboxNetFltRetain((pNetFlt), true /* fBusy */);
    683683    vboxNetFltWinReferenceModeNetFlt(pNetFlt);
    684     RTSpinlockRelease((pNetFlt)->hSpinlock, &Tmp);
     684    RTSpinlockReleaseNoInts((pNetFlt)->hSpinlock, &Tmp);
    685685
    686686    *pbNetFltActive = true;
     
    704704    pNetFlt = PADAPT_2_PVBOXNETFLTINS(pAdapt);
    705705
    706     RTSpinlockAcquire((pNetFlt)->hSpinlock, &Tmp);
    707     if(!ASMAtomicUoReadBool(&(pNetFlt)->fActive))
    708     {
    709         RTSpinlockRelease((pNetFlt)->hSpinlock, &Tmp);
     706    RTSpinlockAcquireNoInts((pNetFlt)->hSpinlock, &Tmp);
     707    if(pNetFlt->enmTrunkState != INTNETTRUNKIFSTATE_ACTIVE)
     708    {
     709        RTSpinlockReleaseNoInts((pNetFlt)->hSpinlock, &Tmp);
    710710        return NULL;
    711711    }
     
    713713    if(!vboxNetFltWinDoIncReferenceDevice(pAdapt, &pAdapt->PTState, v))
    714714    {
    715         RTSpinlockRelease((pNetFlt)->hSpinlock, &Tmp);
     715        RTSpinlockReleaseNoInts((pNetFlt)->hSpinlock, &Tmp);
    716716        return NULL;
    717717    }
     
    719719    vboxNetFltRetain((pNetFlt), true /* fBusy */);
    720720
    721     RTSpinlockRelease((pNetFlt)->hSpinlock, &Tmp);
     721    RTSpinlockReleaseNoInts((pNetFlt)->hSpinlock, &Tmp);
    722722
    723723    /* we have marked it as busy, so can do the res references outside the lock */
     
    742742    }
    743743
    744     RTSpinlockAcquire((pNetFlt)->hSpinlock, &Tmp);
     744    RTSpinlockAcquireNoInts((pNetFlt)->hSpinlock, &Tmp);
    745745#ifndef VBOXNETADP
    746746    if(!vboxNetFltWinDoIncReferenceDevices(pAdapt, &pAdapt->MPState, &pAdapt->PTState, v))
     
    749749#endif
    750750    {
    751         RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp);
     751        RTSpinlockReleaseNoInts(pNetFlt->hSpinlock, &Tmp);
    752752        *pbNetFltActive = false;
    753753        return false;
    754754    }
    755755
    756     if(!ASMAtomicUoReadBool(&(pNetFlt)->fActive))
     756    if(pNetFlt->enmTrunkState != INTNETTRUNKIFSTATE_ACTIVE)
    757757    {
    758758        vboxNetFltWinIncReferenceModePassThru(pNetFlt, v);
    759759
    760         RTSpinlockRelease((pNetFlt)->hSpinlock, &Tmp);
     760        RTSpinlockReleaseNoInts((pNetFlt)->hSpinlock, &Tmp);
    761761        *pbNetFltActive = false;
    762762        return true;
     
    767767    vboxNetFltWinIncReferenceModeNetFlt(pNetFlt, v);
    768768
    769     RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp);
     769    RTSpinlockReleaseNoInts(pNetFlt->hSpinlock, &Tmp);
    770770
    771771    /* we have marked it as busy, so can do the res references outside the lock */
     
    833833    }
    834834
    835     RTSpinlockAcquire(pNetFlt->hSpinlock, &Tmp);
     835    RTSpinlockAcquireNoInts(pNetFlt->hSpinlock, &Tmp);
    836836#ifdef VBOX_NETFLT_ONDEMAND_BIND
    837837    if(vboxNetFltWinDoIncReferenceDevice(pAdapt, &pAdapt->PTState))
     
    842842#endif
    843843    {
    844         RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp);
     844        RTSpinlockReleaseNoInts(pNetFlt->hSpinlock, &Tmp);
    845845        return true;
    846846    }
    847847
    848     RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp);
     848    RTSpinlockReleaseNoInts(pNetFlt->hSpinlock, &Tmp);
    849849    return false;
    850850}
     
    854854    PVBOXNETFLTINS pNetFlt = PADAPT_2_PVBOXNETFLTINS(pAdapt);
    855855    RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
    856     RTSpinlockAcquire(pNetFlt->hSpinlock, &Tmp);
     856    RTSpinlockAcquireNoInts(pNetFlt->hSpinlock, &Tmp);
    857857#ifdef VBOX_NETFLT_ONDEMAND_BIND
    858858    if(vboxNetFltWinDoReferenceDevice(pAdapt, &pAdapt->PTState))
     
    863863#endif
    864864    {
    865         RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp);
     865        RTSpinlockReleaseNoInts(pNetFlt->hSpinlock, &Tmp);
    866866        return true;
    867867    }
    868868
    869     RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp);
     869    RTSpinlockReleaseNoInts(pNetFlt->hSpinlock, &Tmp);
    870870    return false;
    871871}
  • trunk/src/VBox/HostDrivers/VBoxNetFlt/win/VBoxNetFltMp-win.c

    r28800 r28830  
    486486     * fail any request comming later
    487487     */
    488     RTSpinlockAcquire(pNetFlt->hSpinlock, &Tmp);
     488    RTSpinlockAcquireNoInts(pNetFlt->hSpinlock, &Tmp);
    489489
    490490    ASMAtomicUoWriteBool(&pNetFlt->fDisconnectedFromHost, true);
     
    494494    vboxNetFltWinSetOpState(&pAdapt->MPState, kVBoxNetDevOpState_Deinitializing);
    495495
    496     RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp);
     496    RTSpinlockReleaseNoInts(pNetFlt->hSpinlock, &Tmp);
    497497
    498498    vboxNetFltWinWaitDereference(&pAdapt->MPState);
     
    10011001         * If the miniport below is binding, fail the request
    10021002         */
    1003         RTSpinlockAcquire(pNetFlt->hSpinlock, &Tmp);
     1003        RTSpinlockAcquireNoInts(pNetFlt->hSpinlock, &Tmp);
    10041004
    10051005        if (vboxNetFltWinGetOpState(&pAdapt->PTState) > kVBoxNetDevOpState_Initialized)
    10061006        {
    1007             RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp);
     1007            RTSpinlockReleaseNoInts(pNetFlt->hSpinlock, &Tmp);
    10081008            Status = NDIS_STATUS_FAILURE;
    10091009            break;
     
    10171017        {
    10181018            pAdapt->bQueuedRequest = TRUE;
    1019             RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp);
     1019            RTSpinlockReleaseNoInts(pNetFlt->hSpinlock, &Tmp);
    10201020            Status = NDIS_STATUS_PENDING;
    10211021            break;
     
    10261026        if (pAdapt->bStandingBy == TRUE)
    10271027        {
    1028             RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp);
     1028            RTSpinlockReleaseNoInts(pNetFlt->hSpinlock, &Tmp);
    10291029            Status = NDIS_STATUS_FAILURE;
    10301030            break;
     
    10321032        pAdapt->bOutstandingRequests = TRUE;
    10331033
    1034         RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp);
     1034        RTSpinlockReleaseNoInts(pNetFlt->hSpinlock, &Tmp);
    10351035        if(Oid == OID_GEN_CURRENT_PACKET_FILTER && VBOXNETFLT_PROMISCUOUS_SUPPORTED(pAdapt))
    10361036        {
     
    10501050                vboxNetFltWinDereferenceAdapt(pAdapt);
    10511051
    1052                 RTSpinlockAcquire(pNetFlt->hSpinlock, &Tmp);
     1052                RTSpinlockAcquireNoInts(pNetFlt->hSpinlock, &Tmp);
    10531053                pAdapt->bOutstandingRequests = FALSE;
    1054                 RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp);
     1054                RTSpinlockReleaseNoInts(pNetFlt->hSpinlock, &Tmp);
    10551055                break;
    10561056            }
     
    13461346         * If the miniport below is unbinding, fail the request
    13471347         */
    1348         RTSpinlockAcquire(pNetFlt->hSpinlock, &Tmp);
     1348        RTSpinlockAcquireNoInts(pNetFlt->hSpinlock, &Tmp);
    13491349        if (vboxNetFltWinGetOpState(&pAdapt->PTState) > kVBoxNetDevOpState_Initialized)
    13501350        {
    1351             RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp);
     1351            RTSpinlockReleaseNoInts(pNetFlt->hSpinlock, &Tmp);
    13521352            Status = NDIS_STATUS_FAILURE;
    13531353            break;
     
    13621362        {
    13631363            pAdapt->bQueuedRequest = TRUE;
    1364             RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp);
     1364            RTSpinlockReleaseNoInts(pNetFlt->hSpinlock, &Tmp);
    13651365            Status = NDIS_STATUS_PENDING;
    13661366            break;
     
    13711371        if (pAdapt->bStandingBy == TRUE)
    13721372        {
    1373             RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp);
     1373            RTSpinlockReleaseNoInts(pNetFlt->hSpinlock, &Tmp);
    13741374            Status = NDIS_STATUS_FAILURE;
    13751375            break;
     
    13771377        pAdapt->bOutstandingRequests = TRUE;
    13781378
    1379         RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp);
     1379        RTSpinlockReleaseNoInts(pNetFlt->hSpinlock, &Tmp);
    13801380
    13811381        if(Oid == OID_GEN_CURRENT_PACKET_FILTER && VBOXNETFLT_PROMISCUOUS_SUPPORTED(pAdapt))
     
    14131413                    vboxNetFltWinDereferenceAdapt(pAdapt);
    14141414
    1415                     RTSpinlockAcquire(pNetFlt->hSpinlock, &Tmp);
     1415                    RTSpinlockAcquireNoInts(pNetFlt->hSpinlock, &Tmp);
    14161416                    pAdapt->bOutstandingRequests = FALSE;
    1417                     RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp);
     1417                    RTSpinlockReleaseNoInts(pNetFlt->hSpinlock, &Tmp);
    14181418                    break;
    14191419                }
  • trunk/src/VBox/HostDrivers/VBoxNetFlt/win/VBoxNetFltPt-win.c

    r28800 r28830  
    299299     * fail any request comming later
    300300     */
    301     RTSpinlockAcquire(pNetFlt->hSpinlock, &Tmp);
     301    RTSpinlockAcquireNoInts(pNetFlt->hSpinlock, &Tmp);
    302302
    303303    ASMAtomicUoWriteBool(&pNetFlt->fDisconnectedFromHost, true);
     
    332332
    333333
    334     RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp);
     334    RTSpinlockReleaseNoInts(pNetFlt->hSpinlock, &Tmp);
    335335
    336336    if (CompleteRequest == TRUE)
     
    583583            {
    584584                PVBOXNETFLTINS pNetFltIf = PADAPT_2_PVBOXNETFLTINS(pAdapt);
    585                 Assert(!pNetFltIf->fActive);
     585                Assert(pNetFltIf->enmTrunkState != INTNETTRUNKIFSTATE_ACTIVE);
    586586                vboxNetFltWinDereferenceModePassThru(pNetFltIf);
    587587                vboxNetFltWinDereferenceAdapt(pAdapt);
     
    613613              if(pAdapt->fProcessingPacketFilter == VBOXNETFLT_PFP_NETFLT)
    614614              {
    615                   Assert(pNetFltIf->fActive);
     615                  Assert(pNetFltIf->enmTrunkState == INTNETTRUNKIFSTATE_ACTIVE);
    616616                  if(Status == NDIS_STATUS_SUCCESS)
    617617                  {
     
    625625              else if(pAdapt->fProcessingPacketFilter == VBOXNETFLT_PFP_PASSTHRU)
    626626              {
    627                   Assert(!pNetFltIf->fActive);
     627                  Assert(pNetFltIf->enmTrunkState != INTNETTRUNKIFSTATE_ACTIVE);
    628628
    629629                  if(Status == NDIS_STATUS_SUCCESS)
     
    849849    Assert(KeGetCurrentIrql() == DISPATCH_LEVEL);
    850850    do{
    851         RTSpinlockAcquire(pNetFlt->hSpinlock, &Tmp);
     851        RTSpinlockAcquireNoInts(pNetFlt->hSpinlock, &Tmp);
    852852
    853853        Assert(pAdapt->cReceivedPacketCount < MAX_RECEIVE_PACKET_ARRAY_SIZE);
     
    893893            }
    894894        }
    895         RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp);
     895        RTSpinlockReleaseNoInts(pNetFlt->hSpinlock, &Tmp);
    896896    } while(0);
    897897
     
    10891089    do
    10901090    {
    1091         RTSpinlockAcquire(pNetFlt->hSpinlock, &Tmp);
     1091        RTSpinlockAcquireNoInts(pNetFlt->hSpinlock, &Tmp);
    10921092
    10931093        if (pAdapt->cReceivedPacketCount > 0)
     
    11031103            pAdapt->cReceivedPacketCount = 0;
    11041104
    1105             RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp);
     1105            RTSpinlockReleaseNoInts(pNetFlt->hSpinlock, &Tmp);
    11061106
    11071107            if(!bReturn)
     
    11321132
    11331133        /* we are here only in case pAdapt->cReceivedPacketCount == 0 */
    1134         RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp);
     1134        RTSpinlockReleaseNoInts(pNetFlt->hSpinlock, &Tmp);
    11351135    } while (FALSE);
    11361136}
     
    21122112    RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
    21132113
    2114     RTSpinlockAcquire(pNetFlt->hSpinlock, &Tmp);
     2114    RTSpinlockAcquireNoInts(pNetFlt->hSpinlock, &Tmp);
    21152115
    21162116    if(pAdapt->bClosingAdapter)
    21172117    {
    2118         RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp);
     2118        RTSpinlockReleaseNoInts(pNetFlt->hSpinlock, &Tmp);
    21192119        Assert(0);
    21202120        return false;
     
    21222122    if (pAdapt->hBindingHandle == NULL)
    21232123    {
    2124         RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp);
     2124        RTSpinlockReleaseNoInts(pNetFlt->hSpinlock, &Tmp);
    21252125        Assert(0);
    21262126        return false;
     
    21282128
    21292129    pAdapt->bClosingAdapter = true;
    2130     RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp);
     2130    RTSpinlockReleaseNoInts(pNetFlt->hSpinlock, &Tmp);
    21312131
    21322132    /*
     
    21772177     * Set the Internal Device State, this blocks all new sends or receives
    21782178     */
    2179     RTSpinlockAcquire(pNetFlt->hSpinlock, &Tmp);
     2179    RTSpinlockAcquireNoInts(pNetFlt->hSpinlock, &Tmp);
    21802180
    21812181    vboxNetFltWinSetPowerState(&pAdapt->PTState, *pDeviceState);
     
    21932193            pAdapt->bStandingBy = TRUE;
    21942194        }
    2195         RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp);
     2195        RTSpinlockReleaseNoInts(pNetFlt->hSpinlock, &Tmp);
    21962196#ifndef VBOX_NETFLT_ONDEMAND_BIND
    21972197
     
    22182218         * If the below miniport is going to low power state, complete the queued request
    22192219         */
    2220         RTSpinlockAcquire(pNetFlt->hSpinlock, &Tmp);
     2220        RTSpinlockAcquireNoInts(pNetFlt->hSpinlock, &Tmp);
    22212221        if (pAdapt->bQueuedRequest)
    22222222        {
    22232223            pAdapt->bQueuedRequest = FALSE;
    2224             RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp);
     2224            RTSpinlockReleaseNoInts(pNetFlt->hSpinlock, &Tmp);
    22252225            vboxNetFltWinPtRequestComplete(pAdapt, &pAdapt->Request, NDIS_STATUS_FAILURE);
    22262226        }
    22272227        else
    22282228        {
    2229             RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp);
     2229            RTSpinlockReleaseNoInts(pNetFlt->hSpinlock, &Tmp);
    22302230        }
    22312231#endif
     
    22552255
    22562256#ifdef VBOX_NETFLT_ONDEMAND_BIND
    2257         RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp);
     2257        RTSpinlockReleaseNoInts(pNetFlt->hSpinlock, &Tmp);
    22582258#else
    22592259        /*
     
    22682268
    22692269            pAdapt->bOutstandingRequests = TRUE;
    2270             RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp);
     2270            RTSpinlockReleaseNoInts(pNetFlt->hSpinlock, &Tmp);
    22712271
    22722272            NdisRequest(&Status,
     
    22842284        else
    22852285        {
    2286             RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp);
     2286            RTSpinlockReleaseNoInts(pNetFlt->hSpinlock, &Tmp);
    22872287        }
    22882288
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