VirtualBox

Changeset 28258 in vbox for trunk/include


Ignore:
Timestamp:
Apr 13, 2010 2:51:16 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
60000
Message:

PDM critsects for drivers. Fixed critsect cleanup in failure path. Started on new transmit locking scheme (required for intnet buffer serialization).

Location:
trunk/include/VBox
Files:
3 edited

Legend:

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

    r28133 r28258  
    868868     * @thread  The emulation thread.
    869869     */
    870     DECLR3CALLBACKMEMBER(int, pfnPDMQueueCreate,(PPDMDRVINS pDrvIns, uint32_t cbItem, uint32_t cItems, uint32_t cMilliesInterval,
    871                                                  PFNPDMQUEUEDRV pfnCallback, const char *pszName, PPDMQUEUE *ppQueue));
     870    DECLR3CALLBACKMEMBER(int, pfnQueueCreate,(PPDMDRVINS pDrvIns, uint32_t cbItem, uint32_t cItems, uint32_t cMilliesInterval,
     871                                              PFNPDMQUEUEDRV pfnCallback, const char *pszName, PPDMQUEUE *ppQueue));
    872872
    873873    /**
     
    10731073     * @param   pszName     See RTThreadCreate.
    10741074     */
    1075     DECLR3CALLBACKMEMBER(int, pfnPDMThreadCreate,(PPDMDRVINS pDrvIns, PPPDMTHREAD ppThread, void *pvUser, PFNPDMTHREADDRV pfnThread,
    1076                                                   PFNPDMTHREADWAKEUPDRV pfnWakeup, size_t cbStack, RTTHREADTYPE enmType, const char *pszName));
     1075    DECLR3CALLBACKMEMBER(int, pfnThreadCreate,(PPDMDRVINS pDrvIns, PPPDMTHREAD ppThread, void *pvUser, PFNPDMTHREADDRV pfnThread,
     1076                                               PFNPDMTHREADWAKEUPDRV pfnWakeup, size_t cbStack, RTTHREADTYPE enmType, const char *pszName));
    10771077
    10781078    /**
     
    10881088     * @param   pszDesc         Description.
    10891089     */
    1090     DECLR3CALLBACKMEMBER(int, pfnPDMAsyncCompletionTemplateCreate,(PPDMDRVINS pDrvIns, PPPDMASYNCCOMPLETIONTEMPLATE ppTemplate,
    1091                                                                    PFNPDMASYNCCOMPLETEDRV pfnCompleted, void *pvTemplateUser,
    1092                                                                    const char *pszDesc));
     1090    DECLR3CALLBACKMEMBER(int, pfnAsyncCompletionTemplateCreate,(PPDMDRVINS pDrvIns, PPPDMASYNCCOMPLETIONTEMPLATE ppTemplate,
     1091                                                                PFNPDMASYNCCOMPLETEDRV pfnCompleted, void *pvTemplateUser,
     1092                                                                const char *pszDesc));
    10931093
    10941094
     
    11101110     * @thread  EMT
    11111111     */
    1112     DECLR3CALLBACKMEMBER(int, pfnPDMLdrGetRCInterfaceSymbols,(PPDMDRVINS pDrvIns, void *pvInterface, size_t cbInterface,
    1113                                                               const char *pszSymPrefix, const char *pszSymList));
     1112    DECLR3CALLBACKMEMBER(int, pfnLdrGetRCInterfaceSymbols,(PPDMDRVINS pDrvIns, void *pvInterface, size_t cbInterface,
     1113                                                           const char *pszSymPrefix, const char *pszSymList));
    11141114
    11151115    /**
     
    11301130     * @thread  EMT
    11311131     */
    1132     DECLR3CALLBACKMEMBER(int, pfnPDMLdrGetR0InterfaceSymbols,(PPDMDRVINS pDrvIns, void *pvInterface, size_t cbInterface,
    1133                                                               const char *pszSymPrefix, const char *pszSymList));
     1132    DECLR3CALLBACKMEMBER(int, pfnLdrGetR0InterfaceSymbols,(PPDMDRVINS pDrvIns, void *pvInterface, size_t cbInterface,
     1133                                                           const char *pszSymPrefix, const char *pszSymList));
     1134    /**
     1135     * Initializes a PDM critical section.
     1136     *
     1137     * The PDM critical sections are derived from the IPRT critical sections, but
     1138     * works in both RC and R0 as well as R3.
     1139     *
     1140     * @returns VBox status code.
     1141     * @param   pDevIns             The device instance.
     1142     * @param   pCritSect           Pointer to the critical section.
     1143     * @param   RT_SRC_POS_DECL     Use RT_SRC_POS.
     1144     * @param   pszName             The base name of the critical section.  Will be
     1145     *                              mangeled with the instance number.  For
     1146     *                              statistics and lock validation.
     1147     * @param   va                  Arguments for the format string.
     1148     * @thread  EMT
     1149     */
     1150    DECLR3CALLBACKMEMBER(int, pfnCritSectInit,(PPDMDRVINS pDrvIns, PPDMCRITSECT pCritSect,
     1151                                               RT_SRC_POS_DECL, const char *pszName));
    11341152    /** Just a safety precaution. */
    11351153    uint32_t                        u32TheEnd;
     
    12781296
    12791297/**
    1280  * @copydoc PDMDRVHLP::pfnPDMQueueCreate
    1281  */
    1282 DECLINLINE(int) PDMDrvHlpPDMQueueCreate(PPDMDRVINS pDrvIns, uint32_t cbItem, uint32_t cItems, uint32_t cMilliesInterval,
     1298 * @copydoc PDMDRVHLP::pfnQueueCreate
     1299 */
     1300DECLINLINE(int) PDMDrvHlpQueueCreate(PPDMDRVINS pDrvIns, uint32_t cbItem, uint32_t cItems, uint32_t cMilliesInterval,
    12831301                                        PFNPDMQUEUEDRV pfnCallback, const char *pszName, PPDMQUEUE *ppQueue)
    12841302{
    1285     return pDrvIns->pHlpR3->pfnPDMQueueCreate(pDrvIns, cbItem, cItems, cMilliesInterval, pfnCallback, pszName, ppQueue);
     1303    return pDrvIns->pHlpR3->pfnQueueCreate(pDrvIns, cbItem, cItems, cMilliesInterval, pfnCallback, pszName, ppQueue);
    12861304}
    12871305
     
    14631481
    14641482/**
    1465  * @copydoc PDMDRVHLP::pfnPDMThreadCreate
    1466  */
    1467 DECLINLINE(int) PDMDrvHlpPDMThreadCreate(PPDMDRVINS pDrvIns, PPPDMTHREAD ppThread, void *pvUser, PFNPDMTHREADDRV pfnThread,
     1483 * @copydoc PDMDRVHLP::pfnThreadCreate
     1484 */
     1485DECLINLINE(int) PDMDrvHlpThreadCreate(PPDMDRVINS pDrvIns, PPPDMTHREAD ppThread, void *pvUser, PFNPDMTHREADDRV pfnThread,
    14681486                                         PFNPDMTHREADWAKEUPDRV pfnWakeup, size_t cbStack, RTTHREADTYPE enmType, const char *pszName)
    14691487{
    1470     return pDrvIns->pHlpR3->pfnPDMThreadCreate(pDrvIns, ppThread, pvUser, pfnThread, pfnWakeup, cbStack, enmType, pszName);
     1488    return pDrvIns->pHlpR3->pfnThreadCreate(pDrvIns, ppThread, pvUser, pfnThread, pfnWakeup, cbStack, enmType, pszName);
    14711489}
    14721490
    14731491# ifdef VBOX_WITH_PDM_ASYNC_COMPLETION
    14741492/**
    1475  * @copydoc PDMDRVHLP::pfnPDMAsyncCompletionTemplateCreate
    1476  */
    1477 DECLINLINE(int) PDMDrvHlpPDMAsyncCompletionTemplateCreate(PPDMDRVINS pDrvIns, PPPDMASYNCCOMPLETIONTEMPLATE ppTemplate,
    1478                                                           PFNPDMASYNCCOMPLETEDRV pfnCompleted, void *pvTemplateUser, const char *pszDesc)
    1479 {
    1480     return pDrvIns->pHlpR3->pfnPDMAsyncCompletionTemplateCreate(pDrvIns, ppTemplate, pfnCompleted, pvTemplateUser, pszDesc);
     1493 * @copydoc PDMDRVHLP::pfnAsyncCompletionTemplateCreate
     1494 */
     1495DECLINLINE(int) PDMDrvHlpAsyncCompletionTemplateCreate(PPDMDRVINS pDrvIns, PPPDMASYNCCOMPLETIONTEMPLATE ppTemplate,
     1496                                                       PFNPDMASYNCCOMPLETEDRV pfnCompleted, void *pvTemplateUser, const char *pszDesc)
     1497{
     1498    return pDrvIns->pHlpR3->pfnAsyncCompletionTemplateCreate(pDrvIns, ppTemplate, pfnCompleted, pvTemplateUser, pszDesc);
    14811499}
    14821500# endif
     1501
     1502/**
     1503 * @copydoc PDMDRVHLP::pfnCritSectInit
     1504 */
     1505DECLINLINE(int) PDMDrvHlpCritSectInit(PPDMDRVINS pDrvIns, PPDMCRITSECT pCritSect, RT_SRC_POS_DECL, const char *pszName)
     1506{
     1507    return pDrvIns->pHlpR3->pfnCritSectInit(pDrvIns, pCritSect, RT_SRC_POS_ARGS, pszName);
     1508}
    14831509
    14841510
  • trunk/include/VBox/pdmnetifs.h

    r28213 r28258  
    142142
    143143    /**
    144      * Called when there is a buffered of the required size available.
    145      *
    146      * When a PDMINETWORKUP::pfnAllocBuf call fails with VERR_TRY_AGAIN, the
    147      * driver will notify the device/driver up stream when a large enough buffer
    148      * becomes available via this method.
     144     * Do transmit work on the XMIT thread.
     145     *
     146     * When a PDMINETWORKUP::pfnBeginTransmit or PDMINETWORKUP::pfnAllocBuf call
     147     * fails with VERR_TRY_AGAIN, the leaf drivers XMIT thread will offer to process
     148     * the upstream device/driver when the the VERR_TRY_AGAIN condition has been
     149     * removed.  In some cases the VERR_TRY_AGAIN condition is simply being in an
     150     * inconvenient context and the XMIT thread will start working ASAP.
    149151     *
    150152     * @param   pInterface      Pointer to this interface.
    151153     * @thread  Non-EMT.
    152154     */
    153     DECLR3CALLBACKMEMBER(void, pfnNotifyBufAvailable,(PPDMINETWORKDOWN pInterface));
     155    DECLR3CALLBACKMEMBER(void, pfnDoTransmitWork,(PPDMINETWORKDOWN pInterface));
    154156
    155157} PDMINETWORKDOWN;
    156158/** PDMINETWORKDOWN inteface ID. */
    157 #define PDMINETWORKDOWN_IID                     "eb66670b-7998-4470-8e72-886e30f6a9c3"
     159#define PDMINETWORKDOWN_IID                     "52b8cdbb-a087-493b-baa7-81ec3b803e06"
    158160
    159161
     
    182184typedef struct PDMINETWORKUP
    183185{
     186    /**
     187     * Begins a transmit session.
     188     *
     189     * The leaf driver guarantees that there are no concurrent sessions.
     190     *
     191     * @retval  VINF_SUCCESS on success.  Must always call
     192     *          PDMINETWORKUP::pfnEndXmit.
     193     * @retval  VERR_TRY_AGAIN if there is already an open transmit session or some
     194     *          important resource was unavailable (like buffer space).  If it's a
     195     *          resources issue, the driver will signal its XMIT thread and have it
     196     *          work the device thru the PDMINETWORKDOWN::pfnNotifyBufAvailable
     197     *          callback method.
     198     *
     199     * @param   pInterface      Pointer to the interface structure containing the
     200     *                          called function pointer.
     201     *
     202     * @thread  Any, but normally EMT or the XMIT thread.
     203     */
     204    DECLR3CALLBACKMEMBER(int, pfnBeginXmit,(PPDMINETWORKUP pInterface));
     205
    184206    /**
    185207     * Get a send buffer for passing to pfnSendBuf.
     
    206228     *                          owned by the caller, designation owner number 1.
    207229     *
    208      * @thread  Any, but normally EMT.
     230     * @thread  Any, but normally EMT or the XMIT thread.
    209231     */
    210232    DECLR3CALLBACKMEMBER(int, pfnAllocBuf,(PPDMINETWORKUP pInterface, size_t cbMin, PCPDMNETWORKGSO pGso,
     
    221243     *                          ownership shall be 1.
    222244     *
    223      * @thread  Any.
     245     * @thread  Any, but normally EMT or the XMIT thread.
    224246     */
    225247    DECLR3CALLBACKMEMBER(int, pfnFreeBuf,(PPDMINETWORKUP pInterface, PPDMSCATTERGATHER pSgBuf));
     
    243265     *                          if an EMT.
    244266     *
    245      * @thread  Any.
     267     * @thread  Any, but normally EMT or the XMIT thread.
    246268     */
    247269    DECLR3CALLBACKMEMBER(int, pfnSendBuf,(PPDMINETWORKUP pInterface, PPDMSCATTERGATHER pSgBuf, bool fOnWorkerThread));
     270
     271    /**
     272     * Ends a transmit session.
     273     *
     274     * Pairs with successful PDMINETWORKUP::pfnBeginXmit calls.
     275     *
     276     * @param   pInterface      Pointer to the interface structure containing the
     277     *                          called function pointer.
     278     *
     279     * @thread  Any, but normally EMT or the XMIT thread.
     280     */
     281    DECLR3CALLBACKMEMBER(void, pfnEndXmit,(PPDMINETWORKUP pInterface));
    248282
    249283    /**
     
    272306} PDMINETWORKUP;
    273307/** PDMINETWORKUP interface ID. */
    274 #define PDMINETWORKUP_IID                       "3415a37c-4415-43e8-be18-26d9fd2c26a8"
     308#define PDMINETWORKUP_IID                       "67e7e7a8-2594-4649-a1e3-7cee680c6083"
    275309
    276310
  • trunk/include/VBox/uvm.h

    r23000 r28258  
    115115        struct PDMUSERPERVM     s;
    116116#endif
    117         uint8_t                 padding[32];
     117        uint8_t                 padding[64];
    118118    } pdm;
    119119
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette