etherdevice.hh revision 5999
12623SN/A/* 210030SAli.Saidi@ARM.com * Copyright (c) 2007 The Regents of The University of Michigan 38926Sandreas.hansson@arm.com * All rights reserved. 48926Sandreas.hansson@arm.com * 58926Sandreas.hansson@arm.com * Redistribution and use in source and binary forms, with or without 68926Sandreas.hansson@arm.com * modification, are permitted provided that the following conditions are 78926Sandreas.hansson@arm.com * met: redistributions of source code must retain the above copyright 88926Sandreas.hansson@arm.com * notice, this list of conditions and the following disclaimer; 98926Sandreas.hansson@arm.com * redistributions in binary form must reproduce the above copyright 108926Sandreas.hansson@arm.com * notice, this list of conditions and the following disclaimer in the 118926Sandreas.hansson@arm.com * documentation and/or other materials provided with the distribution; 128926Sandreas.hansson@arm.com * neither the name of the copyright holders nor the names of its 138926Sandreas.hansson@arm.com * contributors may be used to endorse or promote products derived from 142623SN/A * this software without specific prior written permission. 152623SN/A * 162623SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 172623SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 182623SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 192623SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 202623SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 212623SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 222623SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 232623SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 242623SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 252623SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 262623SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 272623SN/A * 282623SN/A * Authors: Ali Saidi 292623SN/A */ 302623SN/A 312623SN/A/** 322623SN/A * @file 332623SN/A * Base Ethernet Device declaration. 342623SN/A */ 352623SN/A 362623SN/A#ifndef __DEV_ETHERDEVICE_HH__ 372623SN/A#define __DEV_ETHERDEVICE_HH__ 382623SN/A 392665Ssaidi@eecs.umich.edu#include "base/statistics.hh" 402665Ssaidi@eecs.umich.edu#include "dev/pcidev.hh" 412623SN/A#include "params/EtherDevice.hh" 422623SN/A#include "sim/sim_object.hh" 433170Sstever@eecs.umich.edu 448105Sgblack@eecs.umich.educlass EtherInt; 452623SN/A 464040Ssaidi@eecs.umich.edu/** 479647Sdam.sunwoo@arm.com * The base EtherObject class, allows for an accesor function to a 486658Snate@binkert.org * simobj that returns the Port. 498229Snate@binkert.org */ 502623SN/Aclass EtherDevice : public PciDev 519443SAndreas.Sandberg@ARM.com{ 528232Snate@binkert.org public: 538232Snate@binkert.org typedef EtherDeviceParams Params; 543348Sbinkertn@umich.edu EtherDevice(const Params *params) 553348Sbinkertn@umich.edu : PciDev(params) 568926Sandreas.hansson@arm.com {} 574762Snate@binkert.org 587678Sgblack@eecs.umich.edu const Params * 592901Ssaidi@eecs.umich.edu params() const 608779Sgblack@eecs.umich.edu { 612623SN/A return dynamic_cast<const Params *>(_params); 622623SN/A } 632623SN/A 642623SN/A public: 652623SN/A /** Additional function to return the Port of a memory object. */ 665606Snate@binkert.org virtual EtherInt *getEthPort(const std::string &if_name, int idx = -1) = 0; 672623SN/A 682623SN/A public: 692623SN/A void regStats(); 702623SN/A 712623SN/A protected: 722623SN/A Stats::Scalar txBytes; 732623SN/A Stats::Scalar rxBytes; 742623SN/A Stats::Scalar txPackets; 752623SN/A Stats::Scalar rxPackets; 762623SN/A Stats::Scalar txIpChecksums; 772623SN/A Stats::Scalar rxIpChecksums; 785336Shines@cs.fsu.edu Stats::Scalar txTcpChecksums; 792623SN/A Stats::Scalar rxTcpChecksums; 804873Sstever@eecs.umich.edu Stats::Scalar txUdpChecksums; 812623SN/A Stats::Scalar rxUdpChecksums; 822623SN/A Stats::Scalar descDmaReads; 832623SN/A Stats::Scalar descDmaWrites; 842623SN/A Stats::Scalar descDmaRdBytes; 852623SN/A Stats::Scalar descDmaWrBytes; 862623SN/A Stats::Formula totBandwidth; 878921Sandreas.hansson@arm.com Stats::Formula totPackets; 888921Sandreas.hansson@arm.com Stats::Formula totBytes; 898921Sandreas.hansson@arm.com Stats::Formula totPacketRate; 908921Sandreas.hansson@arm.com Stats::Formula txBandwidth; 919433SAndreas.Sandberg@ARM.com Stats::Formula rxBandwidth; 928779Sgblack@eecs.umich.edu Stats::Formula txPacketRate; 938779Sgblack@eecs.umich.edu Stats::Formula rxPacketRate; 948779Sgblack@eecs.umich.edu Stats::Scalar postedSwi; 958779Sgblack@eecs.umich.edu Stats::Formula coalescedSwi; 968779Sgblack@eecs.umich.edu Stats::Scalar totalSwi; 978779Sgblack@eecs.umich.edu Stats::Scalar postedRxIdle; 982623SN/A Stats::Formula coalescedRxIdle; 998706Sandreas.hansson@arm.com Stats::Scalar totalRxIdle; 1005714Shsul@eecs.umich.edu Stats::Scalar postedRxOk; 1015712Shsul@eecs.umich.edu Stats::Formula coalescedRxOk; 1025712Shsul@eecs.umich.edu Stats::Scalar totalRxOk; 1035712Shsul@eecs.umich.edu Stats::Scalar postedRxDesc; 1042623SN/A Stats::Formula coalescedRxDesc; 1052623SN/A Stats::Scalar totalRxDesc; 1065529Snate@binkert.org Stats::Scalar postedTxOk; 1076078Sgblack@eecs.umich.edu Stats::Formula coalescedTxOk; 1085487Snate@binkert.org Stats::Scalar totalTxOk; 1095487Snate@binkert.org Stats::Scalar postedTxIdle; 1109443SAndreas.Sandberg@ARM.com Stats::Formula coalescedTxIdle; 1119095Sandreas.hansson@arm.com Stats::Scalar totalTxIdle; 1129095Sandreas.hansson@arm.com Stats::Scalar postedTxDesc; 11310381Sdam.sunwoo@arm.com Stats::Formula coalescedTxDesc; 1142623SN/A Stats::Scalar totalTxDesc; 1152623SN/A Stats::Scalar postedRxOrn; 1162623SN/A Stats::Formula coalescedRxOrn; 1172623SN/A Stats::Scalar totalRxOrn; 1182623SN/A Stats::Formula coalescedTotal; 1192623SN/A Stats::Scalar postedInterrupts; 1202623SN/A Stats::Scalar droppedPackets; 1216775SBrad.Beckmann@amd.com}; 1226775SBrad.Beckmann@amd.com 1236775SBrad.Beckmann@amd.com#endif //__DEV_ETHERDEVICE_HH__ 1242623SN/A