VirtualBox

Changeset 59966 in vbox for trunk


Ignore:
Timestamp:
Mar 9, 2016 1:40:06 PM (9 years ago)
Author:
vboxsync
Message:

NetLwf/Win(bugref:8283): test build with 2K frame limit and dynamic re-allocation of frame pool

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/VBoxNetFlt/win/drv/VBoxNetLwf-win.cpp

    r59742 r59966  
    1515 */
    1616#define LOG_GROUP LOG_GROUP_NET_FLT_DRV
     17
     18#define VBOXNETLWF_TEST_NO_FRAMES_OVER_2K
     19//#define VBOXNETLWF_TEST_NO_REALLOCATE
    1720
    1821//#define VBOXNETLWF_SYNC_SEND
     
    909912#endif /* !VBOXNETLWF_SYNC_SEND */
    910913
     914#ifdef VBOXNETLWF_TEST_NO_REALLOCATE
     915    /* Allocate buffer pools */
     916    NET_BUFFER_LIST_POOL_PARAMETERS PoolParams;
     917    NdisZeroMemory(&PoolParams, sizeof(PoolParams));
     918    PoolParams.Header.Type = NDIS_OBJECT_TYPE_DEFAULT;
     919    PoolParams.Header.Revision = NET_BUFFER_LIST_POOL_PARAMETERS_REVISION_1;
     920    PoolParams.Header.Size = sizeof(PoolParams);
     921    PoolParams.ProtocolId = NDIS_PROTOCOL_ID_DEFAULT;
     922    PoolParams.fAllocateNetBuffer = TRUE;
     923    PoolParams.ContextSize = 0; /** @todo Do we need to consider underlying drivers? I think not. */
     924    PoolParams.PoolTag = VBOXNETLWF_MEM_TAG;
     925#ifndef VBOXNETLWF_SYNC_SEND
     926    PoolParams.DataSize = 9088;
     927#endif /* !VBOXNETLWF_SYNC_SEND */
     928               
     929    pModuleCtx->hPool = NdisAllocateNetBufferListPool(hFilter, &PoolParams);
     930    if (!pModuleCtx->hPool)
     931    {
     932        LogError(("vboxNetLwfWinAttach: NdisAllocateNetBufferListPool failed\n"));
     933        NdisFreeIoWorkItem(pModuleCtx->hWorkItem);
     934        NdisFreeMemory(pModuleCtx, 0, 0);
     935        return NDIS_STATUS_RESOURCES;
     936    }
     937    Log4(("vboxNetLwfWinAttach: allocated NBL+NB pool 0x%p\n", pModuleCtx->hPool));
     938#endif /* VBOXNETLWF_TEST_NO_REALLOCATE */
     939
    911940    NDIS_FILTER_ATTRIBUTES Attributes;
    912941    NdisZeroMemory(&Attributes, sizeof(Attributes));
     
    10231052
    10241053    NDIS_STATUS Status = NDIS_STATUS_SUCCESS;
     1054#ifndef VBOXNETLWF_TEST_NO_REALLOCATE
    10251055    ULONG uNewMtuSize = 1500; /* If we fail to find out MTU, we can always assume 1500. */
    10261056    PNDIS_RESTART_ATTRIBUTES pAttributes = pParameters->RestartAttributes;
     
    10771107
    10781108    vboxNetLwfWinChangeState(pModuleCtx, Status == NDIS_STATUS_SUCCESS ? LwfState_Running : LwfState_Paused, LwfState_Restarting);
     1109#else /* !VBOXNETLWF_TEST_NO_REALLOCATE */
     1110    vboxNetLwfWinChangeState(pModuleCtx, LwfState_Running, LwfState_Restarting);
     1111#endif /* !VBOXNETLWF_TEST_NO_REALLOCATE */
    10791112    LogFlow(("<==vboxNetLwfWinRestart: Status = 0x%x\n", Status));
    10801113    return Status;
     
    13211354    }
    13221355#else /* !VBOXNETLWF_SYNC_SEND */
     1356#ifdef VBOXNETLWF_TEST_NO_FRAMES_OVER_2K
     1357    AssertReturn(pSG->cbTotal < 2048, NULL);
     1358#else /* !VBOXNETLWF_TEST_NO_FRAMES_OVER_2K */
    13231359    AssertReturn(pSG->cbTotal <= VBOXNETLWF_MAX_FRAME_SIZE(pModule->uMtuSize), NULL);
     1360#endif /* !VBOXNETLWF_TEST_NO_FRAMES_OVER_2K */
    13241361    PNET_BUFFER_LIST pBufList = NdisAllocateNetBufferList(pModule->hPool,
    13251362                                                          0 /** @todo ContextSize */,
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