diff -r e7ab95880d12 src/devices/wifi/wifi-mac-trailer.cc --- a/src/devices/wifi/wifi-mac-trailer.cc Fri Jul 23 13:39:46 2010 +0200 +++ b/src/devices/wifi/wifi-mac-trailer.cc Fri Jul 23 18:42:49 2010 +0200 @@ -51,18 +51,18 @@ uint32_t WifiMacTrailer::GetSerializedSize (void) const { - return 4; + return WIFI_MAC_FCS_LENGTH; } void WifiMacTrailer::Serialize (Buffer::Iterator start) const { - start.Prev (4); + start.Prev (WIFI_MAC_FCS_LENGTH); start.WriteU32 (0); } uint32_t WifiMacTrailer::Deserialize (Buffer::Iterator start) { - return 4; + return WIFI_MAC_FCS_LENGTH; } } // namespace ns3 diff -r e7ab95880d12 src/devices/wifi/wifi-mac-trailer.h --- a/src/devices/wifi/wifi-mac-trailer.h Fri Jul 23 13:39:46 2010 +0200 +++ b/src/devices/wifi/wifi-mac-trailer.h Fri Jul 23 18:42:49 2010 +0200 @@ -25,6 +25,11 @@ namespace ns3 { +/** + * The length in octects of the IEEE 802.11 MAC FCS field + */ +static const uint16_t WIFI_MAC_FCS_LENGTH = 4; + class WifiMacTrailer : public Trailer { public: diff -r e7ab95880d12 src/devices/wifi/wifi-net-device.cc --- a/src/devices/wifi/wifi-net-device.cc Fri Jul 23 13:39:46 2010 +0200 +++ b/src/devices/wifi/wifi-net-device.cc Fri Jul 23 18:42:49 2010 +0200 @@ -43,7 +43,7 @@ .SetParent () .AddConstructor () .AddAttribute ("Mtu", "The MAC-level Maximum Transmission Unit", - UintegerValue (MAX_MSDU_SIZE), + UintegerValue (MAX_MSDU_SIZE - LLC_SNAP_HEADER_LENGTH), MakeUintegerAccessor (&WifiNetDevice::SetMtu, &WifiNetDevice::GetMtu), MakeUintegerChecker (1,MAX_MSDU_SIZE)) diff -r e7ab95880d12 src/devices/wifi/wifi-remote-station-manager.cc --- a/src/devices/wifi/wifi-remote-station-manager.cc Fri Jul 23 13:39:46 2010 +0200 +++ b/src/devices/wifi/wifi-remote-station-manager.cc Fri Jul 23 18:42:49 2010 +0200 @@ -29,6 +29,7 @@ #include "ns3/wifi-phy.h" #include "ns3/trace-source-accessor.h" #include "wifi-mac-header.h" +#include "wifi-mac-trailer.h" NS_LOG_COMPONENT_DEFINE ("WifiRemoteStationManager"); @@ -151,14 +152,16 @@ UintegerValue (7), MakeUintegerAccessor (&WifiRemoteStationManager::m_maxSlrc), MakeUintegerChecker ()) - .AddAttribute ("RtsCtsThreshold", "If a data packet is bigger than this value, we use an RTS/CTS handshake" - " before sending the data. This value will not have any effect on some rate control algorithms.", + .AddAttribute ("RtsCtsThreshold", "If the size of the data packet + LLC header + MAC header + FCS trailer is bigger than " + "this value, we use an RTS/CTS handshake before sending the data, as per IEEE Std. 802.11-2007, Section 9.2.6. " + "This value will not have any effect on some rate control algorithms.", UintegerValue (1500), MakeUintegerAccessor (&WifiRemoteStationManager::m_rtsCtsThreshold), MakeUintegerChecker ()) - .AddAttribute ("FragmentationThreshold", "If a data packet is bigger than this value, we fragment it such that" - " the size of the fragments are equal or smaller than this value. This value will not have any effect" - " on some rate control algorithms.", + .AddAttribute ("FragmentationThreshold", "If the size of the data packet + LLC header + MAC header + FCS trailer is bigger" + "than this value, we fragment it such that the size of the fragments are equal or smaller " + "than this value, as per IEEE Std. 802.11-2007, Section 9.4. " + "This value will not have any effect on some rate control algorithms.", UintegerValue (1500), MakeUintegerAccessor (&WifiRemoteStationManager::m_fragmentationThreshold), MakeUintegerChecker ()) @@ -458,7 +461,7 @@ { return false; } - bool normally = packet->GetSize () > GetRtsCtsThreshold (); + bool normally = (packet->GetSize () + header->GetSize () + WIFI_MAC_FCS_LENGTH) > GetRtsCtsThreshold (); return DoNeedRts (Lookup (address, header), packet, normally); } bool @@ -488,7 +491,7 @@ return false; } WifiRemoteStation *station = Lookup (address, header); - bool normally = packet->GetSize () > GetFragmentationThreshold (); + bool normally = (packet->GetSize () + header->GetSize () + WIFI_MAC_FCS_LENGTH) > GetFragmentationThreshold (); return DoNeedFragmentation (station, packet, normally); } uint32_t diff -r e7ab95880d12 src/node/llc-snap-header.cc --- a/src/node/llc-snap-header.cc Fri Jul 23 13:39:46 2010 +0200 +++ b/src/node/llc-snap-header.cc Fri Jul 23 18:42:49 2010 +0200 @@ -43,7 +43,7 @@ uint32_t LlcSnapHeader::GetSerializedSize (void) const { - return 1 + 1 + 1 + 3 + 2; + return LLC_SNAP_HEADER_LENGTH; } TypeId diff -r e7ab95880d12 src/node/llc-snap-header.h --- a/src/node/llc-snap-header.h Fri Jul 23 13:39:46 2010 +0200 +++ b/src/node/llc-snap-header.h Fri Jul 23 18:42:49 2010 +0200 @@ -27,6 +27,11 @@ namespace ns3 { +/** + * The length in octects of the LLC/SNAP header + */ +static const uint16_t LLC_SNAP_HEADER_LENGTH = 8; + /** * \ingroup node *