VirtualBox

Changeset 40652 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Mar 26, 2012 4:36:16 PM (13 years ago)
Author:
vboxsync
Message:

NetShaper,E1000: Basic framework and partial implementation for network shaper

Location:
trunk/src/VBox/Devices
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Makefile.kmk

    r40638 r40652  
    391391 endif
    392392
     393 ifdef VBOX_WITH_NETSHAPER
     394  VBoxDD_DEFS           += VBOX_WITH_NETSHAPER
     395  VBoxDD_SOURCES        += \
     396        Network/DrvNetShaper.cpp
     397 endif
     398
    393399 # --- Storage bits. ---
    394400
  • trunk/src/VBox/Devices/Network/DevE1000.cpp

    r40282 r40652  
    184184
    185185#define STATUS_LU       0x00000002
     186#define STATUS_TXOFF    0x00000010
    186187
    187188#define EECD_EE_WIRES 0x0F
     
    31133114        int rc = pDrv->pfnAllocBuf(pDrv, cbMin, fGso ? &pState->GsoCtx : NULL, &pSg);
    31143115        if (RT_FAILURE(rc))
     3116        {
     3117            /* Suspend TX as we are out of buffers atm */
     3118            STATUS |= STATUS_TXOFF;
    31153119            return rc;
     3120        }
    31163121    }
    31173122    else
     
    36423647 * @thread  E1000_TX
    36433648 */
    3644 static void e1kXmitDesc(E1KSTATE* pState, E1KTXDESC* pDesc, RTGCPHYS addr, bool fOnWorkerThread)
    3645 {
     3649static int e1kXmitDesc(E1KSTATE* pState, E1KTXDESC* pDesc, RTGCPHYS addr, bool fOnWorkerThread)
     3650{
     3651    int rc = VINF_SUCCESS;
    36463652    uint32_t cbVTag = 0;
    36473653
     
    37313737                E1kLog3(("%s About to allocate TX buffer: cbVTag=%u\n", INSTANCE(pState), cbVTag));
    37323738                if (e1kCanDoGso(&pState->GsoCtx, &pDesc->data, &pState->contextTSE))
    3733                     e1kXmitAllocBuf(pState, pState->contextTSE.dw2.u20PAYLEN + pState->contextTSE.dw3.u8HDRLEN + cbVTag,
     3739                    rc = e1kXmitAllocBuf(pState, pState->contextTSE.dw2.u20PAYLEN + pState->contextTSE.dw3.u8HDRLEN + cbVTag,
    37343740                                    true /*fExactSize*/, true /*fGso*/);
     3741                else if (pDesc->data.cmd.fTSE)
     3742                    rc = e1kXmitAllocBuf(pState, pState->contextTSE.dw3.u16MSS + pState->contextTSE.dw3.u8HDRLEN + cbVTag,
     3743                                         pDesc->data.cmd.fTSE  /*fExactSize*/, false /*fGso*/);
    37353744                else
    3736                     e1kXmitAllocBuf(pState, pState->contextTSE.dw3.u16MSS + pState->contextTSE.dw3.u8HDRLEN + cbVTag,
    3737                                     pDesc->data.cmd.fTSE  /*fExactSize*/, false /*fGso*/);
     3745                    rc = e1kXmitAllocBuf(pState, pDesc->data.cmd.u20DTALEN + cbVTag,
     3746                                         pDesc->data.cmd.fEOP  /*fExactSize*/, false /*fGso*/);
     3747
     3748                /**
     3749                 * @todo: Perhaps it is not that simple for GSO packets! We may
     3750                 * need to unwind some changes.
     3751                 */
     3752                if (RT_FAILURE(rc))
     3753                {
     3754                    STAM_PROFILE_ADV_STOP(&pState->CTX_SUFF_Z(StatTransmit), a);
     3755                    break;
     3756                }
    37383757                /** @todo Is there any way to indicating errors other than collisions? Like
    37393758                 *        VERR_NET_DOWN. */
     
    38253844                E1kLog3(("%s About to allocate TX buffer: cbVTag=%u\n", INSTANCE(pState), cbVTag));
    38263845                /** @todo reset status bits? */
    3827                 e1kXmitAllocBuf(pState, pDesc->legacy.cmd.u16Length + cbVTag, pDesc->legacy.cmd.fEOP, false /*fGso*/);
     3846                rc = e1kXmitAllocBuf(pState, pDesc->legacy.cmd.u16Length + cbVTag, pDesc->legacy.cmd.fEOP, false /*fGso*/);
     3847                if (RT_FAILURE(rc))
     3848                {
     3849                    STAM_PROFILE_ADV_STOP(&pState->CTX_SUFF_Z(StatTransmit), a);
     3850                    break;
     3851                }
     3852
    38283853                /** @todo Is there any way to indicating errors other than collisions? Like
    38293854                 *        VERR_NET_DOWN. */
     
    38613886            break;
    38623887    }
     3888
     3889    return rc;
    38633890}
    38643891
     
    39003927
    39013928            e1kLoadDesc(pState, &desc, ((uint64_t)TDBAH << 32) + TDBAL + TDH * sizeof(desc));
    3902             e1kXmitDesc(pState, &desc, ((uint64_t)TDBAH << 32) + TDBAL + TDH * sizeof(desc), fOnWorkerThread);
     3929            rc = e1kXmitDesc(pState, &desc, ((uint64_t)TDBAH << 32) + TDBAL + TDH * sizeof(desc), fOnWorkerThread);
     3930            /* If we failed to transmit descriptor we will try it again later */
     3931            if (RT_FAILURE(rc))
     3932                break;
    39033933            if (++TDH * sizeof(desc) >= TDLEN)
    39043934                TDH = 0;
     
    39353965{
    39363966    E1KSTATE *pState = RT_FROM_MEMBER(pInterface, E1KSTATE, INetworkDown);
     3967    /* Resume suspended transmission */
     3968    STATUS &= ~STATUS_TXOFF;
    39373969    e1kXmitPending(pState, true /*fOnWorkerThread*/);
    39383970}
  • trunk/src/VBox/Devices/build/VBoxDD.cpp

    r40591 r40652  
    257257    if (RT_FAILURE(rc))
    258258        return rc;
     259#ifdef VBOX_WITH_NETSHAPER
     260    rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNetShaper);
     261    if (RT_FAILURE(rc))
     262        return rc;
     263#endif /* VBOX_WITH_NETSHAPER */
    259264    rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvAUDIO);
    260265    if (RT_FAILURE(rc))
  • trunk/src/VBox/Devices/build/VBoxDD.h

    r38913 r40652  
    111111extern const PDMDRVREG g_DrvDedicatedNic;
    112112extern const PDMDRVREG g_DrvNAT;
     113#ifdef VBOX_WITH_NETSHAPER
     114extern const PDMDRVREG g_DrvNetShaper;
     115#endif /* VBOX_WITH_NETSHAPER */
    113116extern const PDMDRVREG g_DrvNetSniffer;
    114117extern const PDMDRVREG g_DrvAUDIO;
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