VirtualBox

Changeset 27825 in vbox


Ignore:
Timestamp:
Mar 30, 2010 1:32:40 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
59498
Message:

DevPCNet.cpp: Removed the experimental PCNET_QUEUE_SEND_PACKETS code.

File:
1 edited

Legend:

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

    r26306 r27825  
    7878/* Enable to handle frequent io reads in the guest context (recommended) */
    7979#define PCNET_GC_ENABLED
    80 
    81 /* Experimental: queue TX packets */
    82 //#define PCNET_QUEUE_SEND_PACKETS
    8380
    8481#if defined(LOG_ENABLED)
     
    278275    bool                                fAm79C973;
    279276    uint32_t                            u32LinkSpeed;
    280 
    281 #ifdef PCNET_QUEUE_SEND_PACKETS
    282 # define PCNET_MAX_XMIT_SLOTS           128
    283 # define PCNET_MAX_XMIT_SLOTS_MASK      (PCNET_MAX_XMIT_SLOTS - 1)
    284 
    285     uint32_t                            iXmitRingBufProd;
    286     uint32_t                            iXmitRingBufCons;
    287     /** @todo XXX currently atomic operations on this variable are overkill */
    288     volatile int32_t                    cXmitRingBufPending;
    289     uint16_t                            cbXmitRingBuffer[PCNET_MAX_XMIT_SLOTS];
    290     R3PTRTYPE(uint8_t *)                apXmitRingBuffer[PCNET_MAX_XMIT_SLOTS];
    291 #endif
    292277
    293278    STAMCOUNTER                         StatReceiveBytes;
     
    623608        (R)->rmd2.zeros))
    624609
    625 #if defined(PCNET_QUEUE_SEND_PACKETS) && defined(IN_RING3)
    626 static int pcnetSyncTransmit(PCNetState *pThis);
    627 #endif
    628610static void pcnetPollTimerStart(PCNetState *pThis);
    629611
     
    20822064    /* Clear counter .*/
    20832065    ASMAtomicAndU32(&pThis->cPendingSends, 0);
    2084 #ifdef PCNET_QUEUE_SEND_PACKETS
    2085     int rc = PDMCritSectEnter(&pThis->CritSect, VERR_SEM_BUSY);
    2086     AssertReleaseRC(rc);
    2087     pcnetSyncTransmit(pThis);
    2088     PDMCritSectLeave(&pThis->CritSect);
    2089 #else
    20902066    int rc = RTSemEventSignal(pThis->hSendEventSem);
    20912067    AssertRC(rc);
    2092 #endif
    20932068    return true;
    20942069}
     
    21142089    Assert(cbFrame < sizeof(pThis->abSendBuf));
    21152090
    2116 #ifdef PCNET_QUEUE_SEND_PACKETS
    2117     AssertRelease(pThis->cXmitRingBufPending < PCNET_MAX_XMIT_SLOTS-1);
    2118     pThis->pvSendFrame = pThis->apXmitRingBuffer[pThis->iXmitRingBufProd];
    2119 #else
    21202091    pThis->pvSendFrame = pThis->abSendBuf;
    2121 #endif
    21222092    PDMDevHlpPhysRead(pThis->CTX_SUFF(pDevIns), GCPhysFrame, pThis->pvSendFrame, cbFrame);
    21232093    pThis->cbSendFrame = cbFrame;
     
    21422112DECLINLINE(int) pcnetXmitCompleteFrame(PCNetState *pThis)
    21432113{
    2144 #ifdef PCNET_QUEUE_SEND_PACKETS
    2145     Assert(PDMCritSectIsOwner(&pThis->CritSect));
    2146     AssertRelease(pThis->cXmitRingBufPending < PCNET_MAX_XMIT_SLOTS-1);
    2147     Assert(!pThis->cbXmitRingBuffer[pThis->iXmitRingBufProd]);
    2148 
    2149     pThis->cbXmitRingBuffer[pThis->iXmitRingBufProd] = (uint16_t)pThis->cbSendFrame;
    2150     pThis->iXmitRingBufProd = (pThis->iXmitRingBufProd+1) & PCNET_MAX_XMIT_SLOTS_MASK;
    2151     ASMAtomicIncS32(&pThis->cXmitRingBufPending);
    2152 
    2153     int rc = RTSemEventSignal(pThis->hSendEventSem);
    2154     AssertRC(rc);
    2155 
    2156     return VINF_SUCCESS;
    2157 #else
    21582114    /* Don't hold the critical section while transmitting data. */
    21592115    /** @note also avoids deadlocks with NAT as it can call us right back. */
     
    21702126
    21712127    return PDMCritSectEnter(&pThis->CritSect, VERR_SEM_BUSY);
    2172 #endif
    21732128}
    21742129
     
    22802235 * Try to transmit frames
    22812236 */
    2282 #ifdef PCNET_QUEUE_SEND_PACKETS
    22832237static int pcnetAsyncTransmit(PCNetState *pThis)
    2284 {
    2285     Assert(PDMCritSectIsOwner(&pThis->CritSect));
    2286     size_t cb;
    2287 
    2288     while ((pThis->cXmitRingBufPending > 0))
    2289     {
    2290         cb = pThis->cbXmitRingBuffer[pThis->iXmitRingBufCons];
    2291 
    2292         /* Don't hold the critical section while transmitting data. */
    2293         /** @note also avoids deadlocks with NAT as it can call us right back. */
    2294         PDMCritSectLeave(&pThis->CritSect);
    2295 
    2296         STAM_PROFILE_ADV_START(&pThis->StatTransmitSend, a);
    2297         if (cb > 70) /* unqualified guess */
    2298             pThis->Led.Asserted.s.fWriting = pThis->Led.Actual.s.fWriting = 1;
    2299 
    2300         pThis->pDrv->pfnSend(pThis->pDrv, pThis->apXmitRingBuffer[pThis->iXmitRingBufCons], cb);
    2301         STAM_REL_COUNTER_ADD(&pThis->StatTransmitBytes, cb);
    2302         pThis->Led.Actual.s.fWriting = 0;
    2303         STAM_PROFILE_ADV_STOP(&pThis->StatTransmitSend, a);
    2304 
    2305         int rc = PDMCritSectEnter(&pThis->CritSect, VERR_SEM_BUSY);
    2306         AssertReleaseRC(rc);
    2307 
    2308         pThis->cbXmitRingBuffer[pThis->iXmitRingBufCons] = 0;
    2309         pThis->iXmitRingBufCons = (pThis->iXmitRingBufCons+1) & PCNET_MAX_XMIT_SLOTS_MASK;
    2310         ASMAtomicDecS32(&pThis->cXmitRingBufPending);
    2311     }
    2312     return VINF_SUCCESS;
    2313 }
    2314 
    2315 static int pcnetSyncTransmit(PCNetState *pThis)
    2316 #else
    2317 static int pcnetAsyncTransmit(PCNetState *pThis)
    2318 #endif
    23192238{
    23202239    unsigned cFlushIrq = 0;
     
    49224841        PDMR3CritSectDelete(&pThis->CritSect);
    49234842    }
    4924 #ifdef PCNET_QUEUE_SEND_PACKETS
    4925     if (pThis->apXmitRingBuffer)
    4926         RTMemFree(pThis->apXmitRingBuffer[0]);
    4927 #endif
    49284843    return VINF_SUCCESS;
    49294844}
     
    52225137    rc = PDMDevHlpThreadCreate(pDevIns, &pThis->pSendThread, pThis, pcnetAsyncSendThread, pcnetAsyncSendThreadWakeUp, 0, RTTHREADTYPE_IO, "PCNET_TX");
    52235138    AssertRCReturn(rc, rc);
    5224 
    5225 #ifdef PCNET_QUEUE_SEND_PACKETS
    5226     pThis->apXmitRingBuffer[0] = (uint8_t *)RTMemAlloc(PCNET_MAX_XMIT_SLOTS * MAX_FRAME);
    5227     for (unsigned i = 1; i < PCNET_MAX_XMIT_SLOTS; i++)
    5228         pThis->apXmitRingBuffer[i] = pThis->apXmitRingBuffer[0] + i*MAX_FRAME;
    5229 #endif
    52305139
    52315140#ifdef VBOX_WITH_STATISTICS
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