bug 958 closed

This commit is contained in:
Nicola Baldo
2010-08-02 13:15:36 +02:00
parent ba41fce14c
commit 3e2557f03a
6 changed files with 29 additions and 16 deletions

View File

@@ -51,18 +51,18 @@ WifiMacTrailer::Print (std::ostream &os) const
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

View File

@@ -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:

View File

@@ -43,10 +43,10 @@ WifiNetDevice::GetTypeId (void)
.SetParent<NetDevice> ()
.AddConstructor<WifiNetDevice> ()
.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<uint16_t> (1,MAX_MSDU_SIZE))
MakeUintegerChecker<uint16_t> (1,MAX_MSDU_SIZE - LLC_SNAP_HEADER_LENGTH))
.AddAttribute ("Channel", "The channel attached to this device",
PointerValue (),
MakePointerAccessor (&WifiNetDevice::DoGetChannel),
@@ -191,7 +191,7 @@ WifiNetDevice::GetAddress (void) const
bool
WifiNetDevice::SetMtu (const uint16_t mtu)
{
if (mtu > MAX_MSDU_SIZE)
if (mtu > MAX_MSDU_SIZE - LLC_SNAP_HEADER_LENGTH)
{
return false;
}

View File

@@ -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,15 +152,17 @@ WifiRemoteStationManager::GetTypeId (void)
UintegerValue (7),
MakeUintegerAccessor (&WifiRemoteStationManager::m_maxSlrc),
MakeUintegerChecker<uint32_t> ())
.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.",
UintegerValue (1500),
.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 (2346),
MakeUintegerAccessor (&WifiRemoteStationManager::m_rtsCtsThreshold),
MakeUintegerChecker<uint32_t> ())
.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.",
UintegerValue (1500),
.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 (2346),
MakeUintegerAccessor (&WifiRemoteStationManager::m_fragmentationThreshold),
MakeUintegerChecker<uint32_t> ())
.AddAttribute ("NonUnicastMode", "Wifi mode used for non-unicast transmissions.",
@@ -458,7 +461,7 @@ WifiRemoteStationManager::NeedRts (Mac48Address address, const WifiMacHeader *he
{
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 @@ WifiRemoteStationManager::NeedFragmentation (Mac48Address address, const WifiMac
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

View File

@@ -43,7 +43,7 @@ LlcSnapHeader::GetType (void)
uint32_t
LlcSnapHeader::GetSerializedSize (void) const
{
return 1 + 1 + 1 + 3 + 2;
return LLC_SNAP_HEADER_LENGTH;
}
TypeId

View File

@@ -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
*