Changeset 55922 in vbox
- Timestamp:
- May 19, 2015 3:04:59 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/DevPCNet.cpp
r55909 r55922 1839 1839 else 1840 1840 { 1841 PCRTNETETHERHDR pEth = (PCRTNETETHERHDR)buf; 1842 bool fStrip = false; 1843 size_t len_802_3; 1841 1844 uint8_t *src = &pThis->abRecvBuf[8]; 1842 1845 RTGCPHYS32 crda = CSR_CRDA(pThis); … … 1844 1847 RMD rmd, next_rmd; 1845 1848 1849 /* 1850 * Ethernet framing considers these two octets to be 1851 * payload type; 802.3 framing considers them to be 1852 * payload length. IEEE 802.3x-1997 restricts Ethernet 1853 * type to be greater than or equal to 1536 (0x0600), so 1854 * that both framings can coexist on the wire. 1855 * 1856 * NB: CSR_ASTRP_RCV bit affects only 802.3 frames! 1857 */ 1858 len_802_3 = RT_BE2H_U16(pEth->EtherType); 1859 if (len_802_3 < 46 && CSR_ASTRP_RCV(pThis)) 1860 { 1861 cbToRecv = RT_MIN(sizeof(RTNETETHERHDR) + len_802_3, cbToRecv); 1862 fStrip = true; 1863 fAddFCS = false; 1864 } 1865 1846 1866 memcpy(src, buf, cbToRecv); 1847 if (!CSR_ASTRP_RCV(pThis)) 1848 { 1849 uint32_t fcs = ~0; 1850 uint8_t *p = src; 1851 1867 1868 if (!fStrip) { 1852 1869 while (cbToRecv < 60) 1853 1870 src[cbToRecv++] = 0; 1871 1854 1872 if (fAddFCS) 1855 1873 { 1874 uint32_t fcs = ~0; 1875 uint8_t *p = src; 1876 1856 1877 while (p != &src[cbToRecv]) 1857 1878 CRC(fcs, *p++); 1879 1880 /* FCS at the end of the packet */ 1858 1881 ((uint32_t *)&src[cbToRecv])[0] = htonl(fcs); 1859 /* FCS at end of packet */1860 1882 cbToRecv += 4; 1861 1883 } 1862 1884 } 1885 1863 1886 cbPacket = (int)cbToRecv; Assert((size_t)cbPacket == cbToRecv); 1864 1887
Note:
See TracChangeset
for help on using the changeset viewer.