i8254xGBe.cc (12392:e0dbdf30a2a5) i8254xGBe.cc (12963:214e39f63149)
1/*
2 * Copyright (c) 2006 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 1359 unchanged lines hidden (view full) ---

1368 uint16_t ptype = 0;
1369 uint16_t ip_id = 0;
1370
1371 assert(bytesCopied <= pktPtr->length);
1372 if (bytesCopied == pktPtr->length)
1373 status |= RXDS_EOP;
1374
1375 IpPtr ip(pktPtr);
1/*
2 * Copyright (c) 2006 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 1359 unchanged lines hidden (view full) ---

1368 uint16_t ptype = 0;
1369 uint16_t ip_id = 0;
1370
1371 assert(bytesCopied <= pktPtr->length);
1372 if (bytesCopied == pktPtr->length)
1373 status |= RXDS_EOP;
1374
1375 IpPtr ip(pktPtr);
1376 Ip6Ptr ip6(pktPtr);
1376
1377
1377 if (ip) {
1378 DPRINTF(EthernetDesc, "Proccesing Ip packet with Id=%d\n", ip->id());
1379 ptype |= RXDP_IPV4;
1380 ip_id = ip->id();
1378 if (ip || ip6) {
1379 if (ip) {
1380 DPRINTF(EthernetDesc, "Proccesing Ip packet with Id=%d\n",
1381 ip->id());
1382 ptype |= RXDP_IPV4;
1383 ip_id = ip->id();
1384 }
1385 if (ip6)
1386 ptype |= RXDP_IPV6;
1381
1387
1382 if (igbe->regs.rxcsum.ipofld()) {
1388 if (ip && igbe->regs.rxcsum.ipofld()) {
1383 DPRINTF(EthernetDesc, "Checking IP checksum\n");
1384 status |= RXDS_IPCS;
1385 csum = htole(cksum(ip));
1386 igbe->rxIpChecksums++;
1387 if (cksum(ip) != 0) {
1388 err |= RXDE_IPE;
1389 ext_err |= RXDEE_IPE;
1390 DPRINTF(EthernetDesc, "Checksum is bad!!\n");
1391 }
1392 }
1389 DPRINTF(EthernetDesc, "Checking IP checksum\n");
1390 status |= RXDS_IPCS;
1391 csum = htole(cksum(ip));
1392 igbe->rxIpChecksums++;
1393 if (cksum(ip) != 0) {
1394 err |= RXDE_IPE;
1395 ext_err |= RXDEE_IPE;
1396 DPRINTF(EthernetDesc, "Checksum is bad!!\n");
1397 }
1398 }
1393 TcpPtr tcp(ip);
1399 TcpPtr tcp = ip ? TcpPtr(ip) : TcpPtr(ip6);
1394 if (tcp && igbe->regs.rxcsum.tuofld()) {
1395 DPRINTF(EthernetDesc, "Checking TCP checksum\n");
1396 status |= RXDS_TCPCS;
1397 ptype |= RXDP_TCP;
1398 csum = htole(cksum(tcp));
1399 igbe->rxTcpChecksums++;
1400 if (cksum(tcp) != 0) {
1401 DPRINTF(EthernetDesc, "Checksum is bad!!\n");
1402 err |= RXDE_TCPE;
1403 ext_err |= RXDEE_TCPE;
1404 }
1405 }
1406
1400 if (tcp && igbe->regs.rxcsum.tuofld()) {
1401 DPRINTF(EthernetDesc, "Checking TCP checksum\n");
1402 status |= RXDS_TCPCS;
1403 ptype |= RXDP_TCP;
1404 csum = htole(cksum(tcp));
1405 igbe->rxTcpChecksums++;
1406 if (cksum(tcp) != 0) {
1407 DPRINTF(EthernetDesc, "Checksum is bad!!\n");
1408 err |= RXDE_TCPE;
1409 ext_err |= RXDEE_TCPE;
1410 }
1411 }
1412
1407 UdpPtr udp(ip);
1413 UdpPtr udp = ip ? UdpPtr(ip) : UdpPtr(ip6);
1408 if (udp && igbe->regs.rxcsum.tuofld()) {
1409 DPRINTF(EthernetDesc, "Checking UDP checksum\n");
1410 status |= RXDS_UDPCS;
1411 ptype |= RXDP_UDP;
1412 csum = htole(cksum(udp));
1413 igbe->rxUdpChecksums++;
1414 if (cksum(udp) != 0) {
1415 DPRINTF(EthernetDesc, "Checksum is bad!!\n");

--- 417 unchanged lines hidden (view full) ---

1833 if (TxdOp::rs(desc))
1834 TxdOp::setDd(desc);
1835
1836 DPRINTF(EthernetDesc, "TxDescriptor data d1: %#llx d2: %#llx\n",
1837 desc->d1, desc->d2);
1838
1839 if (useTso) {
1840 IpPtr ip(pktPtr);
1414 if (udp && igbe->regs.rxcsum.tuofld()) {
1415 DPRINTF(EthernetDesc, "Checking UDP checksum\n");
1416 status |= RXDS_UDPCS;
1417 ptype |= RXDP_UDP;
1418 csum = htole(cksum(udp));
1419 igbe->rxUdpChecksums++;
1420 if (cksum(udp) != 0) {
1421 DPRINTF(EthernetDesc, "Checksum is bad!!\n");

--- 417 unchanged lines hidden (view full) ---

1839 if (TxdOp::rs(desc))
1840 TxdOp::setDd(desc);
1841
1842 DPRINTF(EthernetDesc, "TxDescriptor data d1: %#llx d2: %#llx\n",
1843 desc->d1, desc->d2);
1844
1845 if (useTso) {
1846 IpPtr ip(pktPtr);
1847 Ip6Ptr ip6(pktPtr);
1841 if (ip) {
1842 DPRINTF(EthernetDesc, "TSO: Modifying IP header. Id + %d\n",
1843 tsoPkts);
1844 ip->id(ip->id() + tsoPkts++);
1845 ip->len(pktPtr->length - EthPtr(pktPtr)->size());
1848 if (ip) {
1849 DPRINTF(EthernetDesc, "TSO: Modifying IP header. Id + %d\n",
1850 tsoPkts);
1851 ip->id(ip->id() + tsoPkts++);
1852 ip->len(pktPtr->length - EthPtr(pktPtr)->size());
1846
1847 TcpPtr tcp(ip);
1848 if (tcp) {
1849 DPRINTF(EthernetDesc,
1850 "TSO: Modifying TCP header. old seq %d + %d\n",
1851 tcp->seq(), tsoPrevSeq);
1852 tcp->seq(tcp->seq() + tsoPrevSeq);
1853 if (tsoUsedLen != tsoTotalLen)
1854 tcp->flags(tcp->flags() & ~9); // clear fin & psh
1855 }
1856 UdpPtr udp(ip);
1857 if (udp) {
1858 DPRINTF(EthernetDesc, "TSO: Modifying UDP header.\n");
1859 udp->len(pktPtr->length - EthPtr(pktPtr)->size());
1860 }
1861 }
1853 }
1854 if (ip6)
1855 ip6->plen(pktPtr->length - EthPtr(pktPtr)->size());
1856 TcpPtr tcp = ip ? TcpPtr(ip) : TcpPtr(ip6);
1857 if (tcp) {
1858 DPRINTF(EthernetDesc,
1859 "TSO: Modifying TCP header. old seq %d + %d\n",
1860 tcp->seq(), tsoPrevSeq);
1861 tcp->seq(tcp->seq() + tsoPrevSeq);
1862 if (tsoUsedLen != tsoTotalLen)
1863 tcp->flags(tcp->flags() & ~9); // clear fin & psh
1864 }
1865 UdpPtr udp = ip ? UdpPtr(ip) : UdpPtr(ip6);
1866 if (udp) {
1867 DPRINTF(EthernetDesc, "TSO: Modifying UDP header.\n");
1868 udp->len(pktPtr->length - EthPtr(pktPtr)->size());
1869 }
1862 tsoPrevSeq = tsoUsedLen;
1863 }
1864
1865 if (DTRACE(EthernetDesc)) {
1866 IpPtr ip(pktPtr);
1867 if (ip)
1868 DPRINTF(EthernetDesc, "Proccesing Ip packet with Id=%d\n",
1869 ip->id());
1870 else
1871 DPRINTF(EthernetSM, "Proccesing Non-Ip packet\n");
1872 }
1873
1874 // Checksums are only ofloaded for new descriptor types
1870 tsoPrevSeq = tsoUsedLen;
1871 }
1872
1873 if (DTRACE(EthernetDesc)) {
1874 IpPtr ip(pktPtr);
1875 if (ip)
1876 DPRINTF(EthernetDesc, "Proccesing Ip packet with Id=%d\n",
1877 ip->id());
1878 else
1879 DPRINTF(EthernetSM, "Proccesing Non-Ip packet\n");
1880 }
1881
1882 // Checksums are only ofloaded for new descriptor types
1875 if (TxdOp::isData(desc) && ( TxdOp::ixsm(desc) || TxdOp::txsm(desc)) ) {
1883 if (TxdOp::isData(desc) && (TxdOp::ixsm(desc) || TxdOp::txsm(desc))) {
1876 DPRINTF(EthernetDesc, "Calculating checksums for packet\n");
1877 IpPtr ip(pktPtr);
1884 DPRINTF(EthernetDesc, "Calculating checksums for packet\n");
1885 IpPtr ip(pktPtr);
1878 assert(ip);
1879 if (TxdOp::ixsm(desc)) {
1886 Ip6Ptr ip6(pktPtr);
1887 assert(ip || ip6);
1888 if (ip && TxdOp::ixsm(desc)) {
1880 ip->sum(0);
1881 ip->sum(cksum(ip));
1882 igbe->txIpChecksums++;
1883 DPRINTF(EthernetDesc, "Calculated IP checksum\n");
1884 }
1885 if (TxdOp::txsm(desc)) {
1889 ip->sum(0);
1890 ip->sum(cksum(ip));
1891 igbe->txIpChecksums++;
1892 DPRINTF(EthernetDesc, "Calculated IP checksum\n");
1893 }
1894 if (TxdOp::txsm(desc)) {
1886 TcpPtr tcp(ip);
1887 UdpPtr udp(ip);
1895 TcpPtr tcp = ip ? TcpPtr(ip) : TcpPtr(ip6);
1896 UdpPtr udp = ip ? UdpPtr(ip) : UdpPtr(ip6);
1888 if (tcp) {
1889 tcp->sum(0);
1890 tcp->sum(cksum(tcp));
1891 igbe->txTcpChecksums++;
1892 DPRINTF(EthernetDesc, "Calculated TCP checksum\n");
1893 } else if (udp) {
1894 assert(udp);
1895 udp->sum(0);

--- 689 unchanged lines hidden ---
1897 if (tcp) {
1898 tcp->sum(0);
1899 tcp->sum(cksum(tcp));
1900 igbe->txTcpChecksums++;
1901 DPRINTF(EthernetDesc, "Calculated TCP checksum\n");
1902 } else if (udp) {
1903 assert(udp);
1904 udp->sum(0);

--- 689 unchanged lines hidden ---