VirtualBox

Changeset 8085 in vbox


Ignore:
Timestamp:
Apr 17, 2008 9:54:16 AM (17 years ago)
Author:
vboxsync
Message:

pcnet: use a heuristics to decide if we signal the guest about missing RX descriptors

File:
1 edited

Legend:

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

    r7960 r8085  
    8888#define PCNET_PNPMMIO_SIZE              0x20
    8989
    90 #define PCNET_SAVEDSTATE_VERSION        9
     90#define PCNET_SAVEDSTATE_VERSION        10
    9191
    9292#define BCR_MAX_RAP                     50
     
    193193    /** If set the link is temporarily down because of a saved state load. */
    194194    bool                                fLinkTempDown;
     195    /** True if we signal the guest that RX packets are missing. */
     196    bool                                fSignalRxMiss;
    195197
    196198    /** Number of times we've reported the link down. */
     
    15181520#undef PCNET_INIT
    15191521
     1522    size_t cbRxBuffers = 0;
     1523    for (int i = CSR_RCVRL(pData); i >= 1; i--)
     1524    {
     1525        RMD        rmd;
     1526        RTGCPHYS32 addr = pcnetRdraAddr(pData, i);
     1527        /* At this time it is not guaranteed that the buffers are already initialized. */
     1528        if (pcnetRmdLoad(pData, &rmd, PHYSADDR(pData, addr), false))
     1529            cbRxBuffers += 4096-rmd.rmd1.bcnt;
     1530    }
     1531   
     1532    /*
     1533     * Heuristics: The Solaris pcn driver allocates too few RX buffers (128 buffers of a
     1534     * size of 128 bytes are 16KB in summary) leading to frequent RX buffer overflows. In
     1535     * that case we don't signal RX overflows through the CSR0_MISS flag as the driver
     1536     * re-initializes the device on every miss. Other guests use at least 32 buffers of
     1537     * usually 1536 bytes and should therefore not run into condition. If they are still
     1538     * short in RX buffers we notify this condition.
     1539     */
     1540    pData->fSignalRxMiss = (cbRxBuffers == 0 || cbRxBuffers >= 32*_1K);
     1541
    15201542    if (pData->pDrv)
    15211543        pData->pDrv->pfnSetPromiscuousMode(pData->pDrv, CSR_PROM(pData));
     
    15321554    CSR_CXST(pData) = CSR_CXBC(pData) = CSR_NXST(pData) = CSR_NXBC(pData) = 0;
    15331555
    1534     LogRel(("PCNet#%d: Init: ss32=%d GCRDRA=%#010x[%d] GCTDRA=%#010x[%d]\n",
     1556    LogRel(("PCNet#%d: Init: ss32=%d GCRDRA=%#010x[%d] GCTDRA=%#010x[%d]%s\n",
    15351557            PCNET_INST_NR, BCR_SSIZE32(pData),
    1536             pData->GCRDRA, CSR_RCVRL(pData), pData->GCTDRA, CSR_XMTRL(pData)));
     1558            pData->GCRDRA, CSR_RCVRL(pData), pData->GCTDRA, CSR_XMTRL(pData),
     1559            !pData->fSignalRxMiss ? " (CSR0_MISS disabled)" : ""));
    15371560
    15381561    pData->aCSR[0] |=  0x0101;       /* Initialization done */
     
    40804103    SSMR3PutS32(pSSMHandle, pData->iISR);
    40814104    SSMR3PutU32(pSSMHandle, pData->u32Lnkst);
    4082     SSMR3PutBool(pSSMHandle, pData->fPrivIfEnabled);
     4105    SSMR3PutBool(pSSMHandle, pData->fPrivIfEnabled);              /* >= If version 0.9 */
     4106    SSMR3PutBool(pSSMHandle, pData->fSignalRxMiss);               /* >= If version 0.10 */
    40834107    SSMR3PutGCPhys32(pSSMHandle, pData->GCRDRA);
    40844108    SSMR3PutGCPhys32(pSSMHandle, pData->GCTDRA);
     
    40904114    SSMR3PutU64(pSSMHandle, pData->u64LastPoll);
    40914115    SSMR3PutMem(pSSMHandle, &pData->MacConfigured, sizeof(pData->MacConfigured));
    4092     SSMR3PutBool(pSSMHandle, pData->fAm79C973);
     4116    SSMR3PutBool(pSSMHandle, pData->fAm79C973);                   /* >= If version 0.8 */
    40934117    SSMR3PutU32(pSSMHandle, pData->u32LinkSpeed);
    40944118#ifdef PCNET_NO_POLLING
     
    41504174        if (pData->fPrivIfEnabled)
    41514175            LogRel(("PCNet#%d: Enabling private interface\n", PCNET_INST_NR));
     4176    }
     4177    if (   SSM_VERSION_MAJOR(u32Version) >  0
     4178        || SSM_VERSION_MINOR(u32Version) >= 10)
     4179    {
     4180        SSMR3GetBool(pSSMHandle, &pData->fSignalRxMiss);
    41524181    }
    41534182    SSMR3GetGCPhys32(pSSMHandle, &pData->GCRDRA);
     
    42544283
    42554284        if (RT_UNLIKELY(HOST_IS_OWNER(CSR_CRST(pData))))
     4285        {
    42564286            /** @todo Notify the guest _now_. Will potentially increase the interrupt load */
    4257             pData->aCSR[0] |= 0x1000; /* Set MISS flag */
     4287            if (pData->fSignalRxMiss)
     4288                pData->aCSR[0] |= 0x1000; /* Set MISS flag */
     4289        }
    42584290        else
    42594291            rc = VINF_SUCCESS;
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