VirtualBox

Changeset 7762 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Apr 7, 2008 7:12:34 AM (17 years ago)
Author:
vboxsync
Message:

small optimization

File:
1 edited

Legend:

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

    r7756 r7762  
    17171717
    17181718/**
    1719  * Check if there is at least one free receive buffer available.
    1720  */
    1721 static int pcnetCanReceiveNoSync(PCNetState *pData)
    1722 {
    1723     if (RT_UNLIKELY(CSR_DRX(pData) || CSR_STOP(pData) || CSR_SPND(pData)))
    1724         return 0;
    1725 
    1726     if (HOST_IS_OWNER(CSR_CRST(pData)) && pData->GCRDRA)
    1727         pcnetRdtePoll(pData);
    1728 
    1729     if (HOST_IS_OWNER(CSR_CRST(pData)))
    1730     {
    1731         /** @todo Notify the guest _now_. Will potentially increase the interrupt load */
    1732         pData->aCSR[0] |= 0x1000; /* Set MISS flag */
    1733         return 0;
    1734     }
    1735 
    1736     /* byte count stored in two's complement 12 bits wide */
    1737     Log(("#%d pcnetCanReceiveNoSync %d bytes\n", PCNET_INST_NR,
    1738          4096 - CSR_CRBC(pData)));
    1739     return 4096 - CSR_CRBC(pData);
    1740 }
    1741 
    1742 /**
    17431719 * Write data into guest receive buffers.
    17441720 */
     
    25672543
    25682544
    2569 static int pcnetCSRWriteU16(PCNetState *pData, uint32_t u32RAP, uint32_t new_value)
    2570 {
    2571     uint16_t val = new_value;
     2545static int pcnetCSRWriteU16(PCNetState *pData, uint32_t u32RAP, uint32_t val)
     2546{
    25722547    int      rc  = VINF_SUCCESS;
    25732548#ifdef PCNET_DEBUG_CSR
     
    42514226static DECLCALLBACK(size_t) pcnetCanReceive(PPDMINETWORKPORT pInterface)
    42524227{
    4253     size_t cb;
     4228    size_t cb = 0;
    42544229    int    rc;
    42554230    PCNetState *pData = INETWORKPORT_2_DATA(pInterface);
     
    42584233    AssertReleaseRC(rc);
    42594234
    4260     cb = pcnetCanReceiveNoSync(pData);
     4235    if (RT_LIKELY(!CSR_DRX(pData) && !CSR_STOP(pData) && !CSR_SPND(pData)))
     4236    {
     4237        if (HOST_IS_OWNER(CSR_CRST(pData)) && pData->GCRDRA)
     4238            pcnetRdtePoll(pData);
     4239
     4240        if (HOST_IS_OWNER(CSR_CRST(pData)))
     4241        {
     4242            /** @todo Notify the guest _now_. Will potentially increase the interrupt load */
     4243            pData->aCSR[0] |= 0x1000; /* Set MISS flag */
     4244        }
     4245        else
     4246        {
     4247            /* byte count stored in two's complement 12 bits wide */
     4248            Log(("#%d pcnetCanReceiveNoSync %d bytes\n", PCNET_INST_NR, 4096 - CSR_CRBC(pData)));
     4249            cb = 4096 - CSR_CRBC(pData);
     4250        }
     4251    }
    42614252
    42624253    PDMCritSectLeave(&pData->CritSect);
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