VirtualBox

Changeset 40791 in vbox


Ignore:
Timestamp:
Apr 6, 2012 1:46:37 PM (13 years ago)
Author:
vboxsync
Message:

e1000: added EthernetCRC CFGM parameter to make calculation of CRC optional (#6152)

File:
1 edited

Legend:

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

    r40652 r40791  
    979979    /** EMT: */
    980980    bool        fGCEnabled;
     981    /** EMT: Compute Ethernet CRC for RX packets. */
     982    bool        fEthernetCRC;
     983#if HC_ARCH_BITS == 64
     984    uint32_t                Alignment2;
     985#endif
    981986
    982987    /** All: Device register storage. */
     
    10741079    STAMCOUNTER                         StatIntsPrevented;
    10751080    STAMPROFILEADV                      StatReceive;
     1081    STAMPROFILEADV                      StatReceiveCRC;
    10761082    STAMPROFILEADV                      StatReceiveFilter;
    10771083    STAMPROFILEADV                      StatReceiveStore;
     
    20392045    if (!(RCTL & RCTL_SECRC))
    20402046    {
    2041         /* Add FCS if CRC stripping is not enabled */
    2042         *(uint32_t*)(rxPacket + cb) = RTCrc32(rxPacket, cb);
     2047        STAM_PROFILE_ADV_START(&pState->StatReceiveCRC, a);
     2048        /*
     2049         * Add FCS if CRC stripping is not enabled. Since the value of CRC
     2050         * is ignored by most of drivers we may as well save us the trouble
     2051         * of calculating it (see EthernetCRC CFGM parameter).
     2052         */
     2053        if (pState->fEthernetCRC)
     2054            *(uint32_t*)(rxPacket + cb) = RTCrc32(rxPacket, cb);
    20432055        cb += sizeof(uint32_t);
     2056        STAM_PROFILE_ADV_STOP(&pState->StatReceiveCRC, a);
    20442057    }
    20452058    /* Compute checksum of complete packet */
     
    58965909     * Validate configuration.
    58975910     */
    5898     if (!CFGMR3AreValuesValid(pCfg, "MAC\0" "CableConnected\0" "AdapterType\0" "LineSpeed\0" "GCEnabled\0" "R0Enabled\0"))
     5911    if (!CFGMR3AreValuesValid(pCfg, "MAC\0" "CableConnected\0" "AdapterType\0"
     5912                                    "LineSpeed\0" "GCEnabled\0" "R0Enabled\0"
     5913                                    "EthernetCRC\0"))
    58995914        return PDMDEV_SET_ERROR(pDevIns, VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES,
    59005915                                N_("Invalid configuration for E1000 device"));
     
    59045919    pState->fR0Enabled   = true;
    59055920    pState->fGCEnabled   = true;
     5921    pState->fEthernetCRC = true;
    59065922
    59075923    /* Get config params */
     
    59295945        return PDMDEV_SET_ERROR(pDevIns, rc,
    59305946                                N_("Configuration error: Failed to get the value of 'R0Enabled'"));
     5947
     5948    rc = CFGMR3QueryBoolDef(pCfg, "EthernetCRC", &pState->fEthernetCRC, true);
     5949    if (RT_FAILURE(rc))
     5950        return PDMDEV_SET_ERROR(pDevIns, rc,
     5951                                N_("Configuration error: Failed to get the value of 'EthernetCRC'"));
    59315952
    59325953    E1kLog(("%s Chip=%s\n", INSTANCE(pState), g_Chips[pState->eChip].pcszName));
     
    61806201    PDMDevHlpSTAMRegisterF(pDevIns, &pState->StatIntsPrevented,      STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES,     "Number of prevented interrupts",     "/Devices/E1k%d/Interrupts/Prevented", iInstance);
    61816202    PDMDevHlpSTAMRegisterF(pDevIns, &pState->StatReceive,            STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_CALL, "Profiling receive",                  "/Devices/E1k%d/Receive/Total", iInstance);
     6203    PDMDevHlpSTAMRegisterF(pDevIns, &pState->StatReceiveCRC,         STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_CALL, "Profiling receive checksumming",     "/Devices/E1k%d/Receive/CRC", iInstance);
    61826204    PDMDevHlpSTAMRegisterF(pDevIns, &pState->StatReceiveFilter,      STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_CALL, "Profiling receive filtering",        "/Devices/E1k%d/Receive/Filter", iInstance);
    61836205    PDMDevHlpSTAMRegisterF(pDevIns, &pState->StatReceiveStore,       STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_CALL, "Profiling receive storing",          "/Devices/E1k%d/Receive/Store", iInstance);
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