View | Details | Raw Unified | Return to bug 958
Collapse All | Expand All

(-)a/src/devices/wifi/wifi-mac-trailer.cc (-3 / +3 lines)
 Lines 51-68    Link Here 
51
uint32_t 
51
uint32_t 
52
WifiMacTrailer::GetSerializedSize (void) const
52
WifiMacTrailer::GetSerializedSize (void) const
53
{
53
{
54
  return 4;
54
  return WIFI_MAC_FCS_LENGTH;
55
}
55
}
56
void 
56
void 
57
WifiMacTrailer::Serialize (Buffer::Iterator start) const
57
WifiMacTrailer::Serialize (Buffer::Iterator start) const
58
{
58
{
59
  start.Prev (4);
59
  start.Prev (WIFI_MAC_FCS_LENGTH);
60
  start.WriteU32 (0);
60
  start.WriteU32 (0);
61
}
61
}
62
uint32_t
62
uint32_t
63
WifiMacTrailer::Deserialize (Buffer::Iterator start)
63
WifiMacTrailer::Deserialize (Buffer::Iterator start)
64
{
64
{
65
  return 4;
65
  return WIFI_MAC_FCS_LENGTH;
66
}
66
}
67
67
68
} // namespace ns3
68
} // namespace ns3
(-)a/src/devices/wifi/wifi-mac-trailer.h (+5 lines)
 Lines 25-30    Link Here 
25
25
26
namespace ns3 {
26
namespace ns3 {
27
27
28
/** 
29
 * The length in octects of the IEEE 802.11 MAC FCS field
30
 */
31
static const uint16_t WIFI_MAC_FCS_LENGTH = 4;
32
28
class WifiMacTrailer : public Trailer 
33
class WifiMacTrailer : public Trailer 
29
{
34
{
30
public:
35
public:
(-)a/src/devices/wifi/wifi-net-device.cc (-3 / +3 lines)
 Lines 43-52    Link Here 
43
    .SetParent<NetDevice> ()
43
    .SetParent<NetDevice> ()
44
    .AddConstructor<WifiNetDevice> ()
44
    .AddConstructor<WifiNetDevice> ()
45
    .AddAttribute ("Mtu", "The MAC-level Maximum Transmission Unit",
45
    .AddAttribute ("Mtu", "The MAC-level Maximum Transmission Unit",
46
                   UintegerValue (MAX_MSDU_SIZE),
46
                   UintegerValue (MAX_MSDU_SIZE - LLC_SNAP_HEADER_LENGTH),
47
                   MakeUintegerAccessor (&WifiNetDevice::SetMtu,
47
                   MakeUintegerAccessor (&WifiNetDevice::SetMtu,
48
                                         &WifiNetDevice::GetMtu),
48
                                         &WifiNetDevice::GetMtu),
49
                   MakeUintegerChecker<uint16_t> (1,MAX_MSDU_SIZE))
49
                   MakeUintegerChecker<uint16_t> (1,MAX_MSDU_SIZE - LLC_SNAP_HEADER_LENGTH))
50
    .AddAttribute ("Channel", "The channel attached to this device",
50
    .AddAttribute ("Channel", "The channel attached to this device",
51
                   PointerValue (),
51
                   PointerValue (),
52
                   MakePointerAccessor (&WifiNetDevice::DoGetChannel),
52
                   MakePointerAccessor (&WifiNetDevice::DoGetChannel),
 Lines 191-197    Link Here 
191
bool 
191
bool 
192
WifiNetDevice::SetMtu (const uint16_t mtu)
192
WifiNetDevice::SetMtu (const uint16_t mtu)
193
{
193
{
194
  if (mtu > MAX_MSDU_SIZE)
194
  if (mtu > MAX_MSDU_SIZE - LLC_SNAP_HEADER_LENGTH)
195
    {
195
    {
196
      return false;
196
      return false;
197
    }
197
    }
(-)a/src/devices/wifi/wifi-remote-station-manager.cc (-9 / +12 lines)
 Lines 29-34    Link Here 
29
#include "ns3/wifi-phy.h"
29
#include "ns3/wifi-phy.h"
30
#include "ns3/trace-source-accessor.h"
30
#include "ns3/trace-source-accessor.h"
31
#include "wifi-mac-header.h"
31
#include "wifi-mac-header.h"
32
#include "wifi-mac-trailer.h"
32
33
33
NS_LOG_COMPONENT_DEFINE ("WifiRemoteStationManager");
34
NS_LOG_COMPONENT_DEFINE ("WifiRemoteStationManager");
34
35
 Lines 151-165    Link Here 
151
                   UintegerValue (7),
152
                   UintegerValue (7),
152
                   MakeUintegerAccessor (&WifiRemoteStationManager::m_maxSlrc),
153
                   MakeUintegerAccessor (&WifiRemoteStationManager::m_maxSlrc),
153
                   MakeUintegerChecker<uint32_t> ())
154
                   MakeUintegerChecker<uint32_t> ())
154
    .AddAttribute ("RtsCtsThreshold", "If a data packet is bigger than this value, we use an RTS/CTS handshake"
155
    .AddAttribute ("RtsCtsThreshold", "If  the size of the data packet + LLC header + MAC header + FCS trailer is bigger than "
155
                   " before sending the data. This value will not have any effect on some rate control algorithms.",
156
                   "this value, we use an RTS/CTS handshake before sending the data, as per IEEE Std. 802.11-2007, Section 9.2.6. "
156
                   UintegerValue (1500),
157
                   "This value will not have any effect on some rate control algorithms.",
158
                   UintegerValue (2346),
157
                   MakeUintegerAccessor (&WifiRemoteStationManager::m_rtsCtsThreshold),
159
                   MakeUintegerAccessor (&WifiRemoteStationManager::m_rtsCtsThreshold),
158
                   MakeUintegerChecker<uint32_t> ())
160
                   MakeUintegerChecker<uint32_t> ())
159
    .AddAttribute ("FragmentationThreshold", "If a data packet is bigger than this value, we fragment it such that"
161
    .AddAttribute ("FragmentationThreshold", "If the size of the data packet + LLC header + MAC header + FCS trailer is bigger"
160
                   " the size of the fragments are equal or smaller than this value. This value will not have any effect"
162
                   "than this value, we fragment it such that the size of the fragments are equal or smaller "
161
                   " on some rate control algorithms.",
163
                   "than this value, as per IEEE Std. 802.11-2007, Section 9.4. "
162
                   UintegerValue (1500),
164
                   "This value will not have any effect on some rate control algorithms.",
165
                   UintegerValue (2346),
163
                   MakeUintegerAccessor (&WifiRemoteStationManager::m_fragmentationThreshold),
166
                   MakeUintegerAccessor (&WifiRemoteStationManager::m_fragmentationThreshold),
164
                   MakeUintegerChecker<uint32_t> ())
167
                   MakeUintegerChecker<uint32_t> ())
165
    .AddAttribute ("NonUnicastMode", "Wifi mode used for non-unicast transmissions.",
168
    .AddAttribute ("NonUnicastMode", "Wifi mode used for non-unicast transmissions.",
 Lines 458-464    Link Here 
458
    {
461
    {
459
      return false;
462
      return false;
460
    }
463
    }
461
  bool normally = packet->GetSize () > GetRtsCtsThreshold ();
464
  bool normally = (packet->GetSize () + header->GetSize () + WIFI_MAC_FCS_LENGTH) > GetRtsCtsThreshold ();
462
  return DoNeedRts (Lookup (address, header), packet, normally);
465
  return DoNeedRts (Lookup (address, header), packet, normally);
463
}
466
}
464
bool
467
bool
 Lines 488-494    Link Here 
488
      return false;
491
      return false;
489
    }
492
    }
490
  WifiRemoteStation *station = Lookup (address, header);
493
  WifiRemoteStation *station = Lookup (address, header);
491
  bool normally = packet->GetSize () > GetFragmentationThreshold ();
494
  bool normally = (packet->GetSize () + header->GetSize () + WIFI_MAC_FCS_LENGTH) > GetFragmentationThreshold ();
492
  return DoNeedFragmentation (station, packet, normally);
495
  return DoNeedFragmentation (station, packet, normally);
493
}
496
}
494
uint32_t
497
uint32_t
(-)a/src/node/llc-snap-header.cc (-1 / +1 lines)
 Lines 43-49    Link Here 
43
uint32_t 
43
uint32_t 
44
LlcSnapHeader::GetSerializedSize (void) const
44
LlcSnapHeader::GetSerializedSize (void) const
45
{
45
{
46
  return 1 + 1 + 1 + 3 + 2;
46
  return LLC_SNAP_HEADER_LENGTH;
47
}
47
}
48
48
49
TypeId 
49
TypeId 
(-)a/src/node/llc-snap-header.h (+5 lines)
 Lines 27-32    Link Here 
27
27
28
namespace ns3 {
28
namespace ns3 {
29
29
30
/** 
31
 * The length in octects of the LLC/SNAP header
32
 */
33
static const uint16_t LLC_SNAP_HEADER_LENGTH = 8;
34
30
/**
35
/**
31
 * \ingroup node
36
 * \ingroup node
32
 *
37
 *

Return to bug 958