third_party/virtualbox/src/VBox/Devices/Network/DevE1000.cpp
/* currently only used in ring-3 due to stack space requirements of the caller */
/**
 * Set IXSM, IPCS and TCPCS flags according to the packet type.
 *
 * @remarks We emulate checksum offloading for major packets types only.
 *
 * @returns VBox status code.
 * @param   pThis          The device state structure.
 * @param   pFrame          The available data.
 * @param   cb              Number of bytes available in the buffer.
 * @param   status          Bit fields containing status info.
 */
currently only used in ring-3 due to stack space requirements of the caller
Set IXSM, IPCS and TCPCS flags according to the packet type.

@remarks We emulate checksum offloading for major packets types only.

@returns VBox status code.
@param   pThis          The device state structure.
@param   pFrame          The available data.
@param   cb              Number of bytes available in the buffer.
@param   status          Bit fields containing status info.
currently only used in ring - 3 due to stack space requirements of the caller Set IXSM IPCS and TCPCS flags according to the packet type . @remarks We emulate checksum offloading for major packets types only . @returns VBox status code . @param pThis The device state structure . @param pFrame The available data . @param cb Number of bytes available in the buffer . @param status Bit fields containing status info .
static int e1kRxChecksumOffload(PE1KSTATE pThis, const uint8_t *pFrame, size_t cb, E1KRXDST *pStatus)
{
# if 0
    uint16_t uEtherType = ntohs(*(uint16_t*)(pFrame + 12));
    E1kLog2(("%s e1kRxChecksumOffload: EtherType=%x\n", pThis->szPrf, uEtherType));
    switch (uEtherType)
    {
        case 0x800: 
        {
            pStatus->fIXSM  = false;
            pStatus->fIPCS  = true;
            PRTNETIPV4 pIpHdr4 = (PRTNETIPV4)(pFrame + 14);
            pStatus->fTCPCS = pIpHdr4->ip_p == 6 || pIpHdr4->ip_p == 17;
            break;
        }
        case 0x86DD: 
            pStatus->fIXSM = false;
            pStatus->fIPCS  = false;
            pStatus->fTCPCS = true;
            break;
        default: 
            pStatus->fIXSM = true;
            break;
    }
# else
    pStatus->fIXSM = true;
    RT_NOREF_PV(pThis); RT_NOREF_PV(pFrame); RT_NOREF_PV(cb);
# endif
    return VINF_SUCCESS;
}
static int e1kRxChecksumOffload ( PE1KSTATE pThis , const uint8_t * pFrame , size_t cb , E1KRXDST * pStatus ) { # if 0 uint16_t uEtherType = ntohs ( * ( uint16_t * ) ( pFrame + 12 ) ) ; E1kLog2 ( ( " \n " , pThis -> szPrf , uEtherType ) ) ; switch ( uEtherType ) { case 0x800 : { pStatus -> fIXSM = false ; pStatus -> fIPCS = true ; PRTNETIPV4 pIpHdr4 = ( PRTNETIPV4 ) ( pFrame + 14 ) ; pStatus -> fTCPCS = pIpHdr4 -> ip_p == 6 || pIpHdr4 -> ip_p == 17 ; break ; } case 0x86DD : pStatus -> fIXSM = false ; pStatus -> fIPCS = false ; pStatus -> fTCPCS = true ; break ; default : pStatus -> fIXSM = true ; break ; } # else pStatus -> fIXSM = true ; RT_NOREF_PV ( pThis ) ; RT_NOREF_PV ( pFrame ) ; RT_NOREF_PV ( cb ) ; # endif return VINF_SUCCESS ; }
currently only used in ring-3 due to stack space requirements of the caller
 Set IXSM, IPCS and TCPCS flags according to the packet type.
currently only used in ring - 3 due to stack space requirements of the caller Set IXSM IPCS and TCPCS flags according to the packet type .
/** @todo
     * It is not safe to bypass checksum verification for packets coming
     * from real wire. We currently unable to tell where packets are
     * coming from so we tell the driver to ignore our checksum flags
     * and do verification in software.
     */ /* IPv4 */ /* TCP/UDP checksum offloading works with TCP and UDP only */ /* IPv6 */ /* ARP, VLAN, etc. */