fd-net-device: add support for emulation in netmap mode

This commit is contained in:
Pasquale Imputato
2020-05-19 13:28:06 +02:00
committed by Tom Henderson
parent 3766889b74
commit ff8083ca2e
20 changed files with 2221 additions and 53 deletions

View File

@@ -29,6 +29,17 @@ namespace ns3 {
NS_LOG_COMPONENT_DEFINE ("NetDeviceQueueInterface");
TypeId
NetDeviceQueue::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::NetDeviceQueue")
.SetParent<Object> ()
.SetGroupName("Network")
.AddConstructor<NetDeviceQueue> ()
;
return tid;
}
NetDeviceQueue::NetDeviceQueue ()
: m_stoppedByDevice (false),
m_stoppedByQueueLimits (false),
@@ -170,6 +181,12 @@ NetDeviceQueueInterface::GetTypeId (void)
.SetParent<Object> ()
.SetGroupName("Network")
.AddConstructor<NetDeviceQueueInterface> ()
.AddAttribute ("TxQueuesType",
"The type of transmission queues to be used",
TypeId::ATTR_CONSTRUCT,
TypeIdValue (NetDeviceQueue::GetTypeId ()),
MakeTypeIdAccessor (&NetDeviceQueueInterface::SetTxQueuesType),
MakeTypeIdChecker ())
.AddAttribute ("NTxQueues", "The number of device transmission queues",
TypeId::ATTR_GET | TypeId::ATTR_CONSTRUCT,
UintegerValue (1),
@@ -228,6 +245,17 @@ NetDeviceQueueInterface::NotifyNewAggregate (void)
Object::NotifyNewAggregate ();
}
void
NetDeviceQueueInterface::SetTxQueuesType (TypeId type)
{
NS_LOG_FUNCTION (this << type);
NS_ABORT_MSG_IF (!m_txQueuesVector.empty (), "Cannot call SetTxQueuesType after creating device queues");
m_txQueues = ObjectFactory ();
m_txQueues.SetTypeId (type);
}
void
NetDeviceQueueInterface::SetNTxQueues (std::size_t numTxQueues)
{
@@ -239,7 +267,7 @@ NetDeviceQueueInterface::SetNTxQueues (std::size_t numTxQueues)
// create the netdevice queues
for (std::size_t i = 0; i < numTxQueues; i++)
{
m_txQueuesVector.push_back (Create<NetDeviceQueue> ());
m_txQueuesVector.push_back (m_txQueues.Create ()->GetObject<NetDeviceQueue> ());
}
}