VirtualBox

Changeset 23757 in vbox


Ignore:
Timestamp:
Oct 14, 2009 12:05:46 PM (15 years ago)
Author:
vboxsync
Message:

#4330: Fixed E1K hang and ARP offload problem in QNX.

File:
1 edited

Legend:

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

    r23520 r23757  
    4848#include <iprt/crc32.h>
    4949#include <iprt/ctype.h>
     50#include <iprt/net.h>
    5051#include <iprt/semaphore.h>
    5152#include <iprt/string.h>
     
    18011802
    18021803/**
     1804 * Set IXSM, IPCS and TCPCS flags according to the packet type.
     1805 *
     1806 * @remarks We emulate checksum offloading for major packets types only.
     1807 *
     1808 * @returns VBox status code.
     1809 * @param   pState          The device state structure.
     1810 * @param   pFrame          The available data.
     1811 * @param   cb              Number of bytes available in the buffer.
     1812 * @param   status          Bit fields containing status info.
     1813 */
     1814static int e1kRxChecksumOffload(E1KSTATE* pState, const uint8_t *pFrame, size_t cb, E1KRXDST *pStatus)
     1815{
     1816    uint16_t uEtherType = ntohs(*(uint16_t*)(pFrame + 12));
     1817    PRTNETIPV4 pIpHdr4;
     1818
     1819    E1kLog2(("%s e1kRxChecksumOffload: EtherType=%x\n", INSTANCE(pState), uEtherType));
     1820
     1821    //pStatus->fIPE   = false;
     1822    //pStatus->fTCPE  = false;
     1823    switch (uEtherType)
     1824    {
     1825        case 0x800: /* IPv4 */
     1826            pStatus->fIXSM  = false;
     1827            pStatus->fIPCS  = true;
     1828            pIpHdr4 = (PRTNETIPV4)(pFrame + 14);
     1829            /* TCP/UDP checksum offloading works with TCP and UDP only */
     1830            pStatus->fTCPCS = pIpHdr4->ip_p == 6 || pIpHdr4->ip_p == 17;
     1831            break;
     1832        case 0x86DD: /* IPv6 */
     1833            pStatus->fIXSM = false;
     1834            pStatus->fIPCS  = false;
     1835            pStatus->fTCPCS = true;
     1836            break;
     1837        default: /* ARP, VLAN, etc. */
     1838            pStatus->fIXSM = true;
     1839            break;
     1840    }
     1841
     1842    return VINF_SUCCESS;
     1843}
     1844
     1845/**
    18031846 * Pad and store received packet.
    18041847 *
     
    18481891    /* Compute checksum of complete packet */
    18491892    uint16_t checksum = e1kCSum16(rxPacket + GET_BITS(RXCSUM, PCSS), cb);
     1893    e1kRxChecksumOffload(pState, rxPacket, cb, &status);
    18501894
    18511895    /* Update stats */
     
    18901934            desc.u16Checksum   = checksum;
    18911935            desc.status.fDD    = true;
    1892             //desc.fIXSM       = true;
    1893             desc.status.fIPCS  = true;
    1894             desc.status.fTCPCS = true;
    1895             //desc.status.fIPE   = false;
    1896             //desc.status.fTCPE  = false;
     1936
    18971937            /*
    18981938             * We need to leave Rx critical section here or we risk deadlocking
     
    22152255        if (value)
    22162256        {
    2217             if (IMS)
     2257            /*
     2258             * Not clearing ICR causes QNX to hang as it reads ICR in a loop
     2259             * with disabled interrupts.
     2260             */
     2261            //if (IMS)
     2262            if (1)
    22182263            {
    22192264                /*
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