VirtualBox

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


Ignore:
Timestamp:
Jun 25, 2024 8:40:19 PM (5 months ago)
Author:
vboxsync
Message:

Devices/Network: code cleanup. bugref:10268

File:
1 edited

Legend:

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

    r105024 r105025  
    184184    {
    185185        Assert(!pSgBuf->pvUser);
    186 
    187186        RTMemFree(pSgBuf->aSegs[0].pvSeg);
    188         RTMemFree(pSgBuf->pvAllocator);
    189 
    190187        pSgBuf->pvAllocator = NULL;
    191188    }
     
    205202 * @param   pThis               Pointer to the NAT instance.
    206203 * @param   pSgBuf              The scatter/gather buffer.
     204 *
    207205 * @thread  NAT
    208206 */
    209207static DECLCALLBACK(void) drvNATSendWorker(PDRVNAT pThis, PPDMSCATTERGATHER pSgBuf)
    210208{
    211     LogFlowFunc(("pThis=%p pSgBuf=%p\n", pThis, pSgBuf));
    212 
    213209    if (pThis->enmLinkState == PDMNETWORKLINKSTATE_UP)
    214210    {
     
    219215             * A normal frame.
    220216             */
    221             LogFlowFunc(("m=%p\n", m));
    222217            slirp_input(pThis->pNATState->pSlirp, (uint8_t const *)pSgBuf->pvAllocator, (int)pSgBuf->cbUsed);
    223218        }
     
    225220        {
    226221            /*
    227              * M_EXT buf, need to segment it.
     222             * Large/GSO frame.
    228223             */
    229224
     
    254249    }
    255250
    256     LogFlowFunc(("leave\n"));
    257251    drvNATFreeSgBuf(pThis, pSgBuf);
    258252}
     
    260254/**
    261255 * @interface_method_impl{PDMINETWORKUP,pfnBeginXmit}
     256 *
     257 * @param   pInterface      Pointer to UP network interface.
     258 * @param   fOnWorkerThread Unused.
     259 *
     260 * @returns VBox status code.
     261 *
     262 * @thread ?
    262263 */
    263264static DECLCALLBACK(int) drvNATNetworkUp_BeginXmit(PPDMINETWORKUP pInterface, bool fOnWorkerThread)
     
    277278/**
    278279 * @interface_method_impl{PDMINETWORKUP,pfnAllocBuf}
     280 *
     281 * Allocates a scatter/gather buffer for packet/frame handling.
     282 *
     283 * @param   pInterface  Pointer to UP network interface.
     284 * @param   cbMin       Minimum size of buffer to hold packet/frame.
     285 * @param   pGso        The GSO context.
     286 * @param   ppSgBuf     Pointer to the resulting scatter/gather buffer.
     287 *
     288 * @returns VBox status code
     289 *
     290 * @thread ?
    279291 */
    280292static DECLCALLBACK(int) drvNATNetworkUp_AllocBuf(PPDMINETWORKUP pInterface, size_t cbMin,
     
    283295    PDRVNAT pThis = RT_FROM_MEMBER(pInterface, DRVNAT, INetworkUp);
    284296    Assert(RTCritSectIsOwner(&pThis->XmitLock));
    285 
    286     LogFlowFunc(("enter\n"));
    287297
    288298    /*
     
    367377/**
    368378 * @interface_method_impl{PDMINETWORKUP,pfnFreeBuf}
     379 *
     380 * Wrapper function for drvNATFreeSgBuff.
     381 *
     382 * @param   pInterface  Pointer to UP network interface.
     383 * @param   pSgBuf      Pointer to scatter/gather buffer to be freed.
     384 *
     385 * @thread  ?
    369386 */
    370387static DECLCALLBACK(int) drvNATNetworkUp_FreeBuf(PPDMINETWORKUP pInterface, PPDMSCATTERGATHER pSgBuf)
     
    378395/**
    379396 * @interface_method_impl{PDMINETWORKUP,pfnSendBuf}
     397 *
     398 * Sends packet/frame out to network (up from guest).
     399 *
     400 * @param   pInterface      Pointer to UP network interface.
     401 * @param   pSgBuf          Pointer to scatter/gather packet/frame buffer.
     402 * @param   fOnWorkerThread Unused.
     403 *
     404 * @thread  ?
    380405 */
    381406static DECLCALLBACK(int) drvNATNetworkUp_SendBuf(PPDMINETWORKUP pInterface, PPDMSCATTERGATHER pSgBuf, bool fOnWorkerThread)
     
    386411    Assert(RTCritSectIsOwner(&pThis->XmitLock));
    387412
    388     LogFlowFunc(("enter\n"));
    389 
    390413    int rc;
    391414    if (pThis->pSlirpThread->enmState == PDMTHREADSTATE_RUNNING)
     
    397420        {
    398421            drvNATNotifyNATThread(pThis, "drvNATNetworkUp_SendBuf");
    399             LogFlowFunc(("leave success\n"));
    400422            return VINF_SUCCESS;
    401423        }
     
    405427    else
    406428        rc = VERR_NET_DOWN;
     429
    407430    drvNATFreeSgBuf(pThis, pSgBuf);
    408     LogFlowFunc(("leave rc=%Rrc\n", rc));
    409431    return rc;
    410432}
     
    412434/**
    413435 * @interface_method_impl{PDMINETWORKUP,pfnEndXmit}
     436 *
     437 * End transmission.
     438 *
     439 * @param   pInterface  Pointer to UP network interface.
     440 *
     441 * @thread  ?
    414442 */
    415443static DECLCALLBACK(void) drvNATNetworkUp_EndXmit(PPDMINETWORKUP pInterface)
     
    421449/**
    422450 * Get the NAT thread out of poll/WSAWaitForMultipleEvents
     451 *
     452 * @param   pThis   Pointer to DRVNAT state for current context.
     453 * @param   pszWho  String identifying caller.
     454 *
     455 * @thread  ?
    423456 */
    424457static void drvNATNotifyNATThread(PDRVNAT pThis, const char *pszWho)
     
    430463    size_t cbIgnored;
    431464    rc = RTPipeWrite(pThis->hPipeWrite, "", 1, &cbIgnored);
    432 #else
    433     /* kick WSAWaitForMultipleEvents */
    434     rc = WSASetEvent(pThis->hWakeupEvent);
    435465#endif
    436466    AssertRC(rc);
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