dev: Make the EtherDevice class inherit EtherObject.
authorGabe Black <gabeblack@google.com>
Thu, 7 Mar 2019 01:38:23 +0000 (17:38 -0800)
committerGabe Black <gabeblack@google.com>
Fri, 15 Mar 2019 18:13:46 +0000 (18:13 +0000)
This avoids having to define two parallel versions of the getEthPort
function, and the complex dynamic_cast macrame in connectPorts().

Change-Id: I24c09864005ff39a049e50d7245ff17e9480edea
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/17029
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>

src/dev/net/Ethernet.py
src/dev/net/etherdevice.hh

index 6e900e0e8a31bd357d7f699bd7304a7ae23ea7fd..0cf37e230c6eedd213bd7c120605c12c8cdd2251 100644 (file)
@@ -127,6 +127,7 @@ class EtherDevice(PciDevice):
     type = 'EtherDevice'
     abstract = True
     cxx_header = "dev/net/etherdevice.hh"
+    cxx_extra_bases = [ "EtherObject" ]
     interface = MasterPort("Ethernet Interface")
 
 class IGbE(EtherDevice):
index 3ce54958d305beb9d347ab406fbae89a73cb0713..7101ec80a13e2427c6c4e47f665d289e3e98a143 100644 (file)
@@ -37,6 +37,7 @@
 #define __DEV_NET_ETHERDEVICE_HH__
 
 #include "base/statistics.hh"
+#include "dev/net/etherobject.hh"
 #include "dev/pci/device.hh"
 #include "params/EtherDevBase.hh"
 #include "params/EtherDevice.hh"
 
 class EtherInt;
 
-/**
- * The base EtherObject class, allows for an accesor function to a
- * simobj that returns the Port.
- */
-class EtherDevice : public PciDevice
+class EtherDevice : public PciDevice, public EtherObject
 {
   public:
     typedef EtherDeviceParams Params;
@@ -62,10 +59,6 @@ class EtherDevice : public PciDevice
         return dynamic_cast<const Params *>(_params);
     }
 
-  public:
-    /** Additional function to return the Port of a memory object. */
-    virtual EtherInt *getEthPort(const std::string &if_name, int idx = -1) = 0;
-
   public:
     void regStats();