Changeset 23757 in vbox
- Timestamp:
- Oct 14, 2009 12:05:46 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/DevE1000.cpp
r23520 r23757 48 48 #include <iprt/crc32.h> 49 49 #include <iprt/ctype.h> 50 #include <iprt/net.h> 50 51 #include <iprt/semaphore.h> 51 52 #include <iprt/string.h> … … 1801 1802 1802 1803 /** 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 */ 1814 static 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 /** 1803 1846 * Pad and store received packet. 1804 1847 * … … 1848 1891 /* Compute checksum of complete packet */ 1849 1892 uint16_t checksum = e1kCSum16(rxPacket + GET_BITS(RXCSUM, PCSS), cb); 1893 e1kRxChecksumOffload(pState, rxPacket, cb, &status); 1850 1894 1851 1895 /* Update stats */ … … 1890 1934 desc.u16Checksum = checksum; 1891 1935 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 1897 1937 /* 1898 1938 * We need to leave Rx critical section here or we risk deadlocking … … 2215 2255 if (value) 2216 2256 { 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) 2218 2263 { 2219 2264 /*
Note:
See TracChangeset
for help on using the changeset viewer.