* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Authors: Anthony Gutierrez
- * Mohammad Alian
*/
/* @file
interfaces.clear();
}
-EtherInt*
-EtherSwitch::getEthPort(const std::string &if_name, int idx)
+Port &
+EtherSwitch::getPort(const std::string &if_name, PortID idx)
{
- if (idx < 0 || idx >= interfaces.size())
- return nullptr;
-
- Interface *interface = interfaces.at(idx);
- panic_if(interface->getPeer(), "interface already connected\n");
+ if (if_name == "interface") {
+ panic_if(idx < 0 || idx >= interfaces.size(), "index out of bounds");
+ return *interfaces.at(idx);
+ }
- return interface;
+ return SimObject::getPort(if_name, idx);
}
bool
if (!sendPacket(outputFifo.front())) {
DPRINTF(Ethernet, "output port busy...retry later\n");
if (!txEvent.scheduled())
- parent->schedule(txEvent, curTick() + retryTime);
+ parent->schedule(txEvent, curTick() + SimClock::Int::ns);
} else {
DPRINTF(Ethernet, "packet sent: len=%d\n", outputFifo.front()->length);
outputFifo.pop();