Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/17029

Change subject: dev: Make the EtherDevice class inherit EtherObject.
......................................................................

dev: Make the EtherDevice class inherit EtherObject.

This avoids having to define two parallel versions of the getEthPort
function, and the complex dynamic_cast macrame in connectPorts().

Change-Id: I24c09864005ff39a049e50d7245ff17e9480edea
---
M src/dev/net/Ethernet.py
M src/dev/net/etherdevice.hh
2 files changed, 8 insertions(+), 9 deletions(-)



diff --git a/src/dev/net/Ethernet.py b/src/dev/net/Ethernet.py
index 7ef8374..0cf37e2 100644
--- a/src/dev/net/Ethernet.py
+++ b/src/dev/net/Ethernet.py
@@ -47,6 +47,7 @@
 class EtherLink(SimObject):
     type = 'EtherLink'
     cxx_header = "dev/net/etherlink.hh"
+    cxx_extra_bases = [ "EtherObject" ]
     int0 = SlavePort("interface 0")
     int1 = SlavePort("interface 1")
     delay = Param.Latency('0us', "packet transmit delay")
@@ -57,6 +58,7 @@
 class DistEtherLink(SimObject):
     type = 'DistEtherLink'
     cxx_header = "dev/net/dist_etherlink.hh"
+    cxx_extra_bases = [ "EtherObject" ]
     int0 = SlavePort("interface 0")
     delay = Param.Latency('0us', "packet transmit delay")
     delay_var = Param.Latency('0ns', "packet transmit delay variability")
@@ -75,6 +77,7 @@
 class EtherBus(SimObject):
     type = 'EtherBus'
     cxx_header = "dev/net/etherbus.hh"
+    cxx_extra_bases = [ "EtherObject" ]
loopback = Param.Bool(True, "send packet back to the sending interface")
     dump = Param.EtherDump(NULL, "dump object")
speed = Param.NetworkBandwidth('100Mbps', "bus speed in bits per second")
@@ -82,6 +85,7 @@
 class EtherSwitch(SimObject):
     type = 'EtherSwitch'
     cxx_header = "dev/net/etherswitch.hh"
+    cxx_extra_bases = [ "EtherObject" ]
     dump = Param.EtherDump(NULL, "dump object")
fabric_speed = Param.NetworkBandwidth('10Gbps', "switch fabric speed in bits "
                                           "per second")
@@ -95,6 +99,7 @@
     type = 'EtherTapBase'
     abstract = True
     cxx_header = "dev/net/ethertap.hh"
+    cxx_extra_bases = [ "EtherObject" ]
     bufsz = Param.Int(10000, "tap buffer size")
     dump = Param.EtherDump(NULL, "dump object")
     tap = SlavePort("Ethernet interface to connect to gem5's network")
@@ -122,6 +127,7 @@
     type = 'EtherDevice'
     abstract = True
     cxx_header = "dev/net/etherdevice.hh"
+    cxx_extra_bases = [ "EtherObject" ]
     interface = MasterPort("Ethernet Interface")

 class IGbE(EtherDevice):
diff --git a/src/dev/net/etherdevice.hh b/src/dev/net/etherdevice.hh
index 3ce5495..7101ec8 100644
--- a/src/dev/net/etherdevice.hh
+++ b/src/dev/net/etherdevice.hh
@@ -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"
@@ -44,11 +45,7 @@

 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;
@@ -63,10 +60,6 @@
     }

   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();

   protected:

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/17029
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: I24c09864005ff39a049e50d7245ff17e9480edea
Gerrit-Change-Number: 17029
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to