--- a/001-netdevice-queue-state.patch Wed Jun 29 19:11:59 2011 +0200
+++ b/001-netdevice-queue-state.patch Wed Jun 29 22:08:00 2011 +0200
@@ -264,19 +264,15 @@
diff --git a/src/network/model/net-device.h b/src/network/model/net-device.h
--- a/src/network/model/net-device.h
+++ b/src/network/model/net-device.h
-@@ -36,6 +36,11 @@
- class Channel;
- class Packet;
+@@ -29,6 +29,7 @@
+ #include "address.h"
+ #include "ns3/ipv4-address.h"
+ #include "ns3/ipv6-address.h"
++#include "queue-state.h"
-+typedef struct {
-+ uint32_t size;
-+ bool IsFull;
-+} QueueState;
-+
- /**
- * \ingroup network
- * \defgroup netdevice NetDevice
-@@ -331,6 +336,28 @@
+ namespace ns3 {
+
+@@ -331,6 +332,28 @@
*/
virtual bool SupportsSendFrom (void) const = 0;
@@ -305,6 +301,43 @@
};
} // namespace ns3
+diff --git a/src/network/model/queue-state.h b/src/network/model/queue-state.h
+new file mode 100644
+--- /dev/null
++++ b/src/network/model/queue-state.h
+@@ -0,0 +1,32 @@
++/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
++/*
++ * Copyright (c) 2011 Deutsche Telekom Laboratories
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2 as
++ * published by the Free Software Foundation;
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, write to the Free Software
++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
++ *
++ * Author: Ruben Merz <ruben.merz@ieee.org>
++ */
++#ifndef QUEUE_STATE_H
++#define QUEUE_STATE_H
++
++namespace ns3 {
++
++typedef struct {
++ uint32_t size;
++ bool IsStopped;
++} QueueState;
++
++} // namespace ns3
++
++#endif /* QUEUE_STATE_H */
diff --git a/src/network/utils/simple-net-device.cc b/src/network/utils/simple-net-device.cc
--- a/src/network/utils/simple-net-device.cc
+++ b/src/network/utils/simple-net-device.cc
@@ -348,6 +381,17 @@
protected:
virtual void DoDispose (void);
private:
+diff --git a/src/network/wscript b/src/network/wscript
+--- a/src/network/wscript
++++ b/src/network/wscript
+@@ -85,6 +85,7 @@
+ 'model/packet.h',
+ 'model/packet-metadata.h',
+ 'model/packet-tag-list.h',
++ 'model/queue-state.h',
+ 'model/socket.h',
+ 'model/socket-factory.h',
+ 'model/tag.h',
diff --git a/src/openflow/model/openflow-switch-net-device.h b/src/openflow/model/openflow-switch-net-device.h
--- a/src/openflow/model/openflow-switch-net-device.h
+++ b/src/openflow/model/openflow-switch-net-device.h
--- a/002-wifinetdevice-queue-state.patch Wed Jun 29 19:11:59 2011 +0200
+++ b/002-wifinetdevice-queue-state.patch Wed Jun 29 22:08:00 2011 +0200
@@ -179,7 +179,15 @@
diff --git a/src/wifi/model/regular-wifi-mac.cc b/src/wifi/model/regular-wifi-mac.cc
--- a/src/wifi/model/regular-wifi-mac.cc
+++ b/src/wifi/model/regular-wifi-mac.cc
-@@ -59,6 +59,8 @@
+@@ -31,6 +31,7 @@
+ #include "dcf.h"
+ #include "dcf-manager.h"
+ #include "wifi-phy.h"
++#include "wifi-mac-queue.h"
+
+ #include "msdu-aggregator.h"
+
+@@ -59,6 +60,8 @@
m_dca->SetManager (m_dcfManager);
m_dca->SetTxOkCallback (MakeCallback (&RegularWifiMac::TxOk, this));
m_dca->SetTxFailedCallback (MakeCallback (&RegularWifiMac::TxFailed, this));
@@ -188,7 +196,7 @@
// Construct the EDCAFs. The ordering is important - highest
// priority (see Table 9-1 in IEEE 802.11-2007) must be created
-@@ -151,6 +153,8 @@
+@@ -151,6 +154,8 @@
edca->SetTxMiddle (m_txMiddle);
edca->SetTxOkCallback (MakeCallback (&RegularWifiMac::TxOk, this));
edca->SetTxFailedCallback (MakeCallback (&RegularWifiMac::TxFailed, this));
@@ -197,7 +205,7 @@
edca->SetAccessCategory (ac);
edca->CompleteConfig ();
m_edca.insert (std::make_pair (ac, edca));
-@@ -233,6 +237,46 @@
+@@ -233,6 +238,47 @@
}
void
@@ -214,24 +222,25 @@
+ m_queueStop = queueStop;
+}
+
-+uint32_t
++QueueState
+RegularWifiMac::GetQueueState (uint32_t index)
+{
+ NS_ASSERT (index < GetNQueues ());
++
++ QueueState qs;
++
+ if (index == 0)
+ {
-+ if (m_dca->IsQueueStopped ())
-+ return 0;
-+ else
-+ return 1;
++ qs.IsStopped = m_dca->IsQueueStopped ();
++ qs.size = m_dca->GetQueue ()->GetSize ();
+ }
+ else
+ {
-+ if (m_edca[QosUtilsMapTidToAc (index-1)]->IsQueueStopped ())
-+ return 0;
-+ else
-+ return 1;
++ qs.IsStopped = m_edca[QosUtilsMapTidToAc (index-1)]->IsQueueStopped ();
++ qs.size = m_edca[QosUtilsMapTidToAc (index-1)]->GetQueue ()->GetSize ();
+ }
++
++ return qs;
+}
+
+uint32_t
@@ -244,7 +253,7 @@
RegularWifiMac::SetQosSupported (bool enable)
{
NS_LOG_FUNCTION (this);
-@@ -700,4 +744,19 @@
+@@ -700,4 +746,19 @@
m_txErrCallback (hdr);
}
@@ -274,7 +283,7 @@
+
+ virtual void SetTxQueueStartCallback (Callback<bool,uint32_t> queueStart);
+ virtual void SetTxQueueStopCallback (Callback<bool,uint32_t> queueStop);
-+ virtual uint32_t GetQueueState (uint32_t index);
++ virtual QueueState GetQueueState (uint32_t index);
+ virtual uint32_t GetNQueues (void);
+
/* Next functions are not pure virtual so non Qos WifiMacs are not
@@ -332,14 +341,22 @@
diff --git a/src/wifi/model/wifi-mac.h b/src/wifi/model/wifi-mac.h
--- a/src/wifi/model/wifi-mac.h
+++ b/src/wifi/model/wifi-mac.h
-@@ -176,6 +176,12 @@
+@@ -22,6 +22,7 @@
+
+ #include "ns3/packet.h"
+ #include "ns3/mac48-address.h"
++#include "ns3/queue-state.h"
+
+ #include "wifi-phy.h"
+ #include "wifi-remote-station-manager.h"
+@@ -176,6 +177,12 @@
* \param linkDown the callback to invoke when the link becomes down.
*/
virtual void SetLinkDownCallback (Callback<void> linkDown) = 0;
+
+ virtual void SetTxQueueStartCallback (Callback<bool,uint32_t> queueStart) = 0;
+ virtual void SetTxQueueStopCallback (Callback<bool,uint32_t> queueStop) = 0;
-+ virtual uint32_t GetQueueState (uint32_t index) = 0;
++ virtual QueueState GetQueueState (uint32_t index) = 0;
+ virtual uint32_t GetNQueues (void) = 0;
+
/* Next functions are not pure virtual so non Qos WifiMacs are not
@@ -357,7 +374,7 @@
m_stationManager->SetupPhy (m_phy);
m_configComplete = true;
}
-@@ -364,24 +366,48 @@
+@@ -364,25 +366,48 @@
return m_mac->SupportsSendFrom ();
}
@@ -374,10 +391,11 @@
+ return true;
+}
+
- uint32_t
+ QueueState
WifiNetDevice::GetQueueState (uint32_t index)
{
-- return 1;
+- QueueState qs;
+- return qs;
+ return m_mac->GetQueueState (index);
}
uint32_t
@@ -393,7 +411,7 @@
+ // netdevice or the mac layer
+ for (uint32_t i = 0; i < m_mac->GetNQueues (); i++)
+ {
-+ if (m_mac->GetQueueState (i) == 0)
++ if (m_mac->GetQueueState (i).IsStopped == true)
+ {
+ return true;
+ }