VirtualBox

Changeset 82137 in vbox


Ignore:
Timestamp:
Nov 23, 2019 11:38:01 PM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
134947
Message:

DevPCNet: Replaced pXmitQueue with a PDM Task. bugref:9218

File:
1 edited

Legend:

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

    r82136 r82137  
    314314    /** Pointer to the device instance - R3. */
    315315    PPDMDEVINSR3                        pDevInsR3;
    316     /** Transmit signaller - R3. */
    317     R3PTRTYPE(PPDMQUEUE)                pXmitQueueR3;
    318316    /** Pointer to the connector of the attached network driver - R3. */
    319317    PPDMINETWORKUPR3                    pDrvR3;
     
    329327    /** Pointer to the device instance - R0. */
    330328    PPDMDEVINSR0                        pDevInsR0;
    331     /** Transmit signaller - R0. */
    332     R0PTRTYPE(PPDMQUEUE)                pXmitQueueR0;
    333329    /** Pointer to the connector of the attached network driver - R0. */
    334330    PPDMINETWORKUPR0                    pDrvR0;
     
    336332    /** Pointer to the device instance - RC. */
    337333    PPDMDEVINSRC                        pDevInsRC;
    338     /** Transmit signaller - RC. */
    339     RCPTRTYPE(PPDMQUEUE)                pXmitQueueRC;
    340334    /** Pointer to the connector of the attached network driver - RC. */
    341335    PPDMINETWORKUPRC                    pDrvRC;
    342     RTRCPTR                             RCPtrAlignment;
    343336
    344337    /** Software Interrupt timer - R3. */
     
    351344     *  This is used to disconnect and reconnect the link after a restore. */
    352345    TMTIMERHANDLE                       hTimerRestore;
     346
     347    /** Transmit signaller. */
     348    PDMTASKHANDLE                       hXmitTask;
    353349
    354350    /** Register Address Pointer */
     
    16441640/**
    16451641 * Poll Receive Descriptor Table Entry and cache the results in the appropriate registers.
    1646  * Note: Once a descriptor belongs to the network card (this driver), it cannot be changed
    1647  * by the host (the guest driver) anymore. Well, it could but the results are undefined by
    1648  * definition.
    1649  * @param  fSkipCurrent       if true, don't scan the current RDTE.
     1642 *
     1643 * @note    Once a descriptor belongs to the network card (this driver), it
     1644 *          cannot be changed by the host (the guest driver) anymore. Well, it
     1645 *          could but the results are undefined by definition.
     1646 *
     1647 * @param   pDevIns         The device instance.
     1648 * @param   fSkipCurrent    if true, don't scan the current RDTE.
    16501649 */
    16511650static void pcnetRdtePoll(PPCNETSTATE pThis, bool fSkipCurrent=false)
     
    20972096#ifdef IN_RING3
    20982097/**
    2099  * Transmit queue consumer
    2100  * This is just a very simple way of delaying sending to R3.
    2101  *
    2102  * @returns Success indicator.
    2103  *          If false the item will not be removed and the flushing will stop.
    2104  * @param   pDevIns     The device instance.
    2105  * @param   pItem       The item to consume. Upon return this item will be freed.
    2106  */
    2107 static DECLCALLBACK(bool) pcnetXmitQueueConsumer(PPDMDEVINS pDevIns, PPDMQUEUEITEMCORE pItem)
     2098 * @callback_method_impl{FNPDMTASKDEV,
     2099 * This is just a very simple way of delaying sending to R3.}
     2100 */
     2101static DECLCALLBACK(void) pcnetR3XmitTaskCallback(PPDMDEVINS pDevIns, void *pvUser)
    21082102{
    21092103    PPCNETSTATE pThis = PDMDEVINS_2_DATA(pDevIns, PPCNETSTATE);
    2110     NOREF(pItem);
     2104    NOREF(pvUser);
    21112105
    21122106    /*
     
    21142108     */
    21152109    pcnetXmitPending(pThis, true /*fOnWorkerThread*/);
    2116 
    2117     return true;
    21182110}
    21192111#endif /* IN_RING3 */
     
    24162408    if (!pThis->CTX_SUFF(pDrv))
    24172409    {
    2418         PPDMQUEUEITEMCORE pItem = PDMQueueAlloc(pThis->CTX_SUFF(pXmitQueue));
    2419         if (RT_UNLIKELY(pItem))
    2420             PDMQueueInsert(pThis->CTX_SUFF(pXmitQueue), pItem);
     2410        int rc = PDMDevHlpTaskTrigger(pThis->CTX_SUFF(pDevIns), pThis->hXmitTask);
     2411        AssertRC(rc);
    24212412    }
    24222413    else
     
    50425033    PPCNETSTATE pThis = PDMDEVINS_2_DATA(pDevIns, PPCNETSTATE);
    50435034    pThis->pDevInsRC     = PDMDEVINS_2_RCPTR(pDevIns);
    5044     pThis->pXmitQueueRC  = PDMQueueRCPtr(pThis->pXmitQueueR3);
    50455035#ifdef PCNET_NO_POLLING
    50465036    pThis->pfnEMInterpretInstructionRC += offDelta;
     
    53345324     * Create the transmit queue.
    53355325     */
    5336     rc = PDMDevHlpQueueCreate(pDevIns, sizeof(PDMQUEUEITEMCORE), 1, 0,
    5337                               pcnetXmitQueueConsumer, true, "PCnet-Xmit", &pThis->pXmitQueueR3);
     5326    rc = PDMDevHlpTaskCreate(pDevIns, PDMTASK_F_RZ, "PCnet-Xmit", pcnetR3XmitTaskCallback, NULL /*pvUser*/, &pThis->hXmitTask);
    53385327    AssertRCReturn(rc, rc);
    5339     pThis->pXmitQueueR0 = PDMQueueR0Ptr(pThis->pXmitQueueR3);
    5340     pThis->pXmitQueueRC = PDMQueueRCPtr(pThis->pXmitQueueR3);
    53415328
    53425329    /*
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